uawdijnntqw1x1x1
IP : 216.73.216.231
Hostname : 213-108-241-110.cprapid.com
Kernel : Linux 213-108-241-110.cprapid.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
digilove
/
public_html
/
cache
/
.
/
..
/
41423
/
com_banners.tar
/
/
controllers/banner.php000064400000004773152326033420011103 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Banner controller class. * * @since 1.6 */ class BannersControllerBanner extends JControllerForm { /** * The prefix to use with controller messages. * * @var string * @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()) { $filter = $this->input->getInt('filter_category_id'); $categoryId = ArrayHelper::getValue($data, 'catid', $filter, 'int'); $allow = null; if ($categoryId) { // If the category has been passed in the URL check it. $allow = JFactory::getUser()->authorise('core.create', $this->option . '.category.' . $categoryId); } if ($allow !== null) { return $allow; } // In the absence of better information, revert to the component permissions. return parent::allowAdd($data); } /** * 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') { $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 JFactory::getUser()->authorise('core.edit', $this->option . '.category.' . $categoryId); } // 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) { $this->checkToken(); // 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); } } controllers/banners.php000064400000004667152326033420011270 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Banners list controller class. * * @since 1.6 */ class BannersControllerBanners extends JControllerAdmin { /** * The prefix to use with controller messages. * * @var string * @since 1.6 */ protected $text_prefix = 'COM_BANNERS_BANNERS'; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy * @since 1.6 */ public function __construct($config = array()) { parent::__construct($config); $this->registerTask('sticky_unpublish', 'sticky_publish'); } /** * 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 JModelLegacy The model. * * @since 1.6 */ public function getModel($name = 'Banner', $prefix = 'BannersModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } /** * Stick items * * @return void * * @since 1.6 */ public function sticky_publish() { // Check for request forgeries. $this->checkToken(); $ids = (array) $this->input->get('cid', array(), 'int'); $values = array('sticky_publish' => 1, 'sticky_unpublish' => 0); $task = $this->getTask(); $value = ArrayHelper::getValue($values, $task, 0, 'int'); // Remove zero values resulting from input filter $ids = array_filter($ids); if (empty($ids)) { JError::raiseWarning(500, JText::_('COM_BANNERS_NO_BANNERS_SELECTED')); } else { // Get the model. /** @var BannersModelBanner $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'); } } controllers/client.php000064400000001012152326033420011073 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Client controller class. * * @since 1.6 */ class BannersControllerClient extends JControllerForm { /** * The prefix to use with controller messages. * * @var string * @since 1.6 */ protected $text_prefix = 'COM_BANNERS_CLIENT'; } controllers/clients.php000064400000001777152326033420011300 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Clients list controller class. * * @since 1.6 */ class BannersControllerClients extends JControllerAdmin { /** * The prefix to use with controller messages. * * @var string * @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 JModelLegacy The model. * * @since 1.6 */ public function getModel($name = 'Client', $prefix = 'BannersModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } } controllers/index.html000064400000000037152326033420011107 0ustar00<!DOCTYPE html><title></title> controllers/tracks.php000064400000004364152326033420011121 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Tracks list controller class. * * @since 1.6 */ class BannersControllerTracks extends JControllerLegacy { /** * The prefix to use with controller messages. * * @var string * @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 JModelLegacy The model. * * @since 1.6 */ public function getModel($name = 'Tracks', $prefix = 'BannersModel', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, $config); } /** * Method to remove a record. * * @return void * * @since 1.6 */ public function delete() { // Check for request forgeries. $this->checkToken(); // Get the model. /** @var BannersModelTracks $model */ $model = $this->getModel(); // Load the filter state. $app = JFactory::getApplication(); $model->setState('filter.type', $app->getUserState($this->context . '.filter.type')); $model->setState('filter.begin', $app->getUserState($this->context . '.filter.begin')); $model->setState('filter.end', $app->getUserState($this->context . '.filter.end')); $model->setState('filter.category_id', $app->getUserState($this->context . '.filter.category_id')); $model->setState('filter.client_id', $app->getUserState($this->context . '.filter.client_id')); $model->setState('list.limit', 0); $model->setState('list.start', 0); $count = $model->getTotal(); // Remove the items. if (!$model->delete()) { JError::raiseWarning(500, $model->getError()); } elseif ($count > 0) { $this->setMessage(JText::plural('COM_BANNERS_TRACKS_N_ITEMS_DELETED', $count)); } else { $this->setMessage(JText::_('COM_BANNERS_TRACKS_NO_ITEMS_DELETED')); } $this->setRedirect('index.php?option=com_banners&view=tracks'); } } controllers/tracks.raw.php000064400000006566152326033420011717 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Tracks list controller class. * * @since 1.6 */ class BannersControllerTracks extends JControllerLegacy { /** * The context for persistent state. * * @var string * @since 1.6 */ protected $context = 'com_banners.tracks'; /** * Method to get a model object, loading it if required. * * @param string $name The name of the model. * @param string $prefix The prefix for the model class name. * @param array $config Configuration array for model. Optional. * * @return JModelLegacy * * @since 1.6 */ public function getModel($name = 'Tracks', $prefix = 'BannersModel', $config = array()) { return parent::getModel($name, $prefix, array('ignore_request' => true)); } /** * Display method for the raw track data. * * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return BannersControllerTracks This object to support chaining. * * @since 1.5 * @todo This should be done as a view, not here! */ public function display($cachable = false, $urlparams = array()) { // Check for request forgeries. $this->checkToken('GET'); // Get the document object. $vName = 'tracks'; // Get and render the view. if ($view = $this->getView($vName, 'raw')) { // Get the model for the view. /** @var BannersModelTracks $model */ $model = $this->getModel($vName); // Load the filter state. $app = JFactory::getApplication(); $model->setState('filter.type', $app->getUserState($this->context . '.filter.type')); $model->setState('filter.begin', $app->getUserState($this->context . '.filter.begin')); $model->setState('filter.end', $app->getUserState($this->context . '.filter.end')); $model->setState('filter.category_id', $app->getUserState($this->context . '.filter.category_id')); $model->setState('filter.client_id', $app->getUserState($this->context . '.filter.client_id')); $model->setState('list.limit', 0); $model->setState('list.start', 0); $form = $this->input->get('jform', array(), 'array'); $model->setState('basename', $form['basename']); $model->setState('compressed', $form['compressed']); // Create one year cookies. $cookieLifeTime = time() + 365 * 86400; $cookieDomain = $app->get('cookie_domain', ''); $cookiePath = $app->get('cookie_path', '/'); $isHttpsForced = $app->isHttpsForced(); $app->input->cookie->set( JApplicationHelper::getHash($this->context . '.basename'), $form['basename'], $cookieLifeTime, $cookiePath, $cookieDomain, $isHttpsForced, true ); $app->input->cookie->set( JApplicationHelper::getHash($this->context . '.compressed'), $form['compressed'], $cookieLifeTime, $cookiePath, $cookieDomain, $isHttpsForced, true ); // Push the model into the view (as default). $view->setModel($model, true); // Push document object into the view. $view->document = JFactory::getDocument(); $view->display(); } return $this; } } helpers/html/banner.php000064400000005333152326033420011134 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Banner HTML class. * * @since 2.5 */ abstract class JHtmlBanner { /** * Display a batch widget for the client selector. * * @return string The necessary HTML for the widget. * * @since 2.5 */ public static function clients() { JHtml::_('bootstrap.tooltip'); // Create the batch selector to change the client on a selection list. return implode( "\n", array( '<label id="batch-client-lbl" for="batch-client" class="hasTooltip" title="' . JHtml::_('tooltipText', 'COM_BANNERS_BATCH_CLIENT_LABEL', 'COM_BANNERS_BATCH_CLIENT_LABEL_DESC') . '">', JText::_('COM_BANNERS_BATCH_CLIENT_LABEL'), '</label>', '<select name="batch[client_id]" id="batch-client-id">', '<option value="">' . JText::_('COM_BANNERS_BATCH_CLIENT_NOCHANGE') . '</option>', '<option value="0">' . JText::_('COM_BANNERS_NO_CLIENT') . '</option>', JHtml::_('select.options', static::clientlist(), 'value', 'text'), '</select>' ) ); } /** * Method to get the field options. * * @return array The field option objects. * * @since 1.6 */ public static function clientlist() { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('id As value, name As text') ->from('#__banner_clients AS a') ->order('a.name'); // Get the options. $db->setQuery($query); try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); } return $options; } /** * Returns a pinned state on a grid * * @param integer $value The state value. * @param integer $i The row index * @param boolean $enabled An optional setting for access control on the action. * @param string $checkbox An optional prefix for checkboxes. * * @return string The Html code * * @see JHtmlJGrid::state * @since 2.5.5 */ public static function pinned($value, $i, $enabled = true, $checkbox = 'cb') { $states = array( 1 => array( 'sticky_unpublish', 'COM_BANNERS_BANNERS_PINNED', 'COM_BANNERS_BANNERS_HTML_PIN_BANNER', 'COM_BANNERS_BANNERS_PINNED', true, 'publish', 'publish' ), 0 => array( 'sticky_publish', 'COM_BANNERS_BANNERS_UNPINNED', 'COM_BANNERS_BANNERS_HTML_UNPIN_BANNER', 'COM_BANNERS_BANNERS_UNPINNED', true, 'unpublish', 'unpublish' ), ); return JHtml::_('jgrid.state', $states, $value, $i, 'banners.', $enabled, true, $checkbox); } } helpers/html/index.html000064400000000037152326033420011147 0ustar00<!DOCTYPE html><title></title> helpers/banners.php000064400000011140152326033420010344 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Banners component helper. * * @since 1.6 */ class BannersHelper extends JHelperContent { /** * Configure the Linkbar. * * @param string $vName The name of the active view. * * @return void * * @since 1.6 */ public static function addSubmenu($vName) { JHtmlSidebar::addEntry( JText::_('COM_BANNERS_SUBMENU_BANNERS'), 'index.php?option=com_banners&view=banners', $vName == 'banners' ); JHtmlSidebar::addEntry( JText::_('COM_BANNERS_SUBMENU_CATEGORIES'), 'index.php?option=com_categories&extension=com_banners', $vName == 'categories' ); JHtmlSidebar::addEntry( JText::_('COM_BANNERS_SUBMENU_CLIENTS'), 'index.php?option=com_banners&view=clients', $vName == 'clients' ); JHtmlSidebar::addEntry( JText::_('COM_BANNERS_SUBMENU_TRACKS'), 'index.php?option=com_banners&view=tracks', $vName == 'tracks' ); } /** * Update / reset the banners * * @return boolean * * @since 1.6 */ public static function updateReset() { $db = JFactory::getDbo(); $nullDate = $db->getNullDate(); $query = $db->getQuery(true) ->select('*') ->from('#__banners') ->where($db->quote(JFactory::getDate()) . ' >= ' . $db->quote('reset')) ->where($db->quoteName('reset') . ' != ' . $db->quote($nullDate) . ' AND ' . $db->quoteName('reset') . '!= NULL') ->where( '(' . $db->quoteName('checked_out') . ' = 0 OR ' . $db->quoteName('checked_out') . ' = ' . (int) $db->quote(JFactory::getUser()->id) . ')' ); $db->setQuery($query); try { $rows = $db->loadObjectList(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); return false; } JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables'); foreach ($rows as $row) { $purchaseType = $row->purchase_type; if ($purchaseType < 0 && $row->cid) { /** @var BannersTableClient $client */ $client = JTable::getInstance('Client', 'BannersTable'); $client->load($row->cid); $purchaseType = $client->purchase_type; } if ($purchaseType < 0) { $params = JComponentHelper::getParams('com_banners'); $purchaseType = $params->get('purchase_type'); } switch ($purchaseType) { case 1: $reset = $nullDate; break; case 2: $date = JFactory::getDate('+1 year ' . date('Y-m-d')); $reset = $db->quote($date->toSql()); break; case 3: $date = JFactory::getDate('+1 month ' . date('Y-m-d')); $reset = $db->quote($date->toSql()); break; case 4: $date = JFactory::getDate('+7 day ' . date('Y-m-d')); $reset = $db->quote($date->toSql()); break; case 5: $date = JFactory::getDate('+1 day ' . date('Y-m-d')); $reset = $db->quote($date->toSql()); break; } // Update the row ordering field. $query->clear() ->update($db->quoteName('#__banners')) ->set($db->quoteName('reset') . ' = ' . $db->quote($reset)) ->set($db->quoteName('impmade') . ' = ' . $db->quote(0)) ->set($db->quoteName('clicks') . ' = ' . $db->quote(0)) ->where($db->quoteName('id') . ' = ' . $db->quote($row->id)); $db->setQuery($query); try { $db->execute(); } catch (RuntimeException $e) { JError::raiseWarning(500, $db->getMessage()); return false; } } return true; } /** * Get client list in text/value format for a select field * * @return array */ public static function getClientOptions() { $options = array(); $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('id AS value, name AS text') ->from('#__banner_clients AS a') ->where('a.state = 1') ->order('a.name'); // Get the options. $db->setQuery($query); try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); } array_unshift($options, JHtml::_('select.option', '0', JText::_('COM_BANNERS_NO_CLIENT'))); return $options; } /** * Adds Count Items for Category Manager. * * @param stdClass[] &$items The category objects * * @return stdClass[] * * @since 3.5 */ public static function countItems(&$items) { $config = (object) array( 'related_tbl' => 'banners', 'state_col' => 'state', 'group_col' => 'catid', 'relation_type' => 'category_or_group', ); return parent::countRelations($items, $config); } } helpers/index.html000064400000000037152326033420010203 0ustar00<!DOCTYPE html><title></title> models/fields/bannerclient.php000064400000001531152326033420012452 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); JFormHelper::loadFieldClass('list'); /** * Bannerclient field. * * @since 1.6 */ class JFormFieldBannerClient extends JFormFieldList { /** * The form field type. * * @var string * @since 1.6 */ protected $type = 'BannerClient'; /** * Method to get the field options. * * @return array The field option objects. * * @since 1.6 */ public function getOptions() { return array_merge(parent::getOptions(), BannersHelper::getClientOptions()); } } models/fields/clicks.php000064400000002022152326033420011252 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Clicks field. * * @since 1.6 */ class JFormFieldClicks extends JFormField { /** * The form field type. * * @var string * @since 1.6 */ protected $type = 'Clicks'; /** * Method to get the field input markup. * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { $onclick = ' onclick="document.getElementById(\'' . $this->id . '\').value=\'0\';"'; return '<input class="input-small" type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly" /> <a class="btn" ' . $onclick . '>' . '<span class="icon-refresh" aria-hidden="true"></span> ' . JText::_('COM_BANNERS_RESET_CLICKS') . '</a>'; } } models/fields/impmade.php000064400000002032152326033420011417 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Impressions field. * * @since 1.6 */ class JFormFieldImpMade extends JFormField { /** * The form field type. * * @var string * @since 1.6 */ protected $type = 'ImpMade'; /** * Method to get the field input markup. * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { $onclick = ' onclick="document.getElementById(\'' . $this->id . '\').value=\'0\';"'; return '<input class="input-small" type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly" /> <a class="btn" ' . $onclick . '>' . '<span class="icon-refresh" aria-hidden="true"></span> ' . JText::_('COM_BANNERS_RESET_IMPMADE') . '</a>'; } } models/fields/imptotal.php000064400000003046152326033420011642 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Total Impressions field. * * @since 1.6 */ class JFormFieldImpTotal extends JFormField { /** * The form field type. * * @var string * @since 1.6 */ protected $type = 'ImpTotal'; /** * Method to get the field input markup. * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { $class = ' class="validate-numeric text_area"'; $onchange = ' onchange="document.getElementById(\'' . $this->id . '_unlimited\').checked=document.getElementById(\'' . $this->id . '\').value==\'\';"'; $onclick = ' onclick="if (document.getElementById(\'' . $this->id . '_unlimited\').checked) document.getElementById(\'' . $this->id . '\').value=\'\';"'; $value = empty($this->value) ? '' : $this->value; $checked = empty($this->value) ? ' checked="checked"' : ''; return '<input type="text" name="' . $this->name . '" id="' . $this->id . '" size="9" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" ' . $class . $onchange . ' />' . '<fieldset class="checkbox impunlimited"><input id="' . $this->id . '_unlimited" type="checkbox"' . $checked . $onclick . ' />' . '<label for="' . $this->id . '_unlimited" id="jform-imp" type="text">' . JText::_('COM_BANNERS_UNLIMITED') . '</label></fieldset>'; } } models/fields/index.html000064400000000037152326033420011272 0ustar00<!DOCTYPE html><title></title> models/forms/banner.xml000064400000020526152326033420011151 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <fieldset name="details" addfieldpath="/administrator/components/com_banners/models/fields"> <field name="id" type="number" label="JGLOBAL_FIELD_ID_LABEL" description="JGLOBAL_FIELD_ID_DESC" default="0" readonly="true" class="readonly" /> <field name="name" type="text" label="COM_BANNERS_FIELD_NAME_LABEL" description="COM_BANNERS_FIELD_NAME_DESC" class="input-xxlarge input-large-text" size="40" required="true" /> <field name="alias" type="text" label="JFIELD_ALIAS_LABEL" description="COM_BANNERS_FIELD_ALIAS_DESC" size="40" hint="JFIELD_ALIAS_PLACEHOLDER" /> <field name="catid" type="categoryedit" label="JCATEGORY" description="COM_BANNERS_FIELD_CATEGORY_DESC" extension="com_banners" required="true" addfieldpath="/administrator/components/com_categories/models/fields" default="" /> <field name="state" type="list" label="JSTATUS" description="COM_BANNERS_FIELD_STATE_DESC" class="chzn-color-state" size="1" default="1" > <option value="1">JPUBLISHED</option> <option value="0">JUNPUBLISHED</option> <option value="2">JARCHIVED</option> <option value="-2">JTRASHED</option> </field> <field name="ordering" type="ordering" label="JFIELD_ORDERING_LABEL" description="JFIELD_ORDERING_DESC" table="#__banners" /> <field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" description="COM_BANNERS_FIELD_LANGUAGE_DESC" > <option value="*">JALL</option> </field> <field name="version_note" type="text" label="JGLOBAL_FIELD_VERSION_NOTE_LABEL" description="JGLOBAL_FIELD_VERSION_NOTE_DESC" maxlength="255" class="span12" size="45" labelclass="control-label" /> <field name="description" type="editor" label="JGLOBAL_DESCRIPTION" description="COM_BANNERS_FIELD_DESCRIPTION_DESC" filter="JComponentHelper::filterText" buttons="true" hide="readmore,pagebreak,module,article,contact,menu" /> <field name="type" type="list" label="COM_BANNERS_FIELD_TYPE_LABEL" description="COM_BANNERS_FIELD_TYPE_DESC" default="0" > <option value="0">COM_BANNERS_FIELD_VALUE_IMAGE</option> <option value="1">COM_BANNERS_FIELD_VALUE_CUSTOM</option> </field> <field name="custombannercode" type="textarea" label="COM_BANNERS_FIELD_CUSTOMCODE_LABEL" description="COM_BANNERS_FIELD_CUSTOMCODE_DESC" rows="3" cols="30" filter="raw" /> <field name="clickurl" type="url" label="COM_BANNERS_FIELD_CLICKURL_LABEL" description="COM_BANNERS_FIELD_CLICKURL_DESC" filter="url" validate="url" /> </fieldset> <fieldset name="publish" label="COM_BANNERS_GROUP_LABEL_PUBLISHING_DETAILS"> <field name="created" type="calendar" label="COM_BANNERS_FIELD_CREATED_LABEL" description="COM_BANNERS_FIELD_CREATED_DESC" size="22" translateformat="true" showtime="true" filter="user_utc" /> <field name="created_by" type="user" label="COM_BANNERS_FIELD_CREATED_BY_LABEL" description="COM_BANNERS_FIELD_CREATED_BY_DESC" /> <field name="created_by_alias" type="text" label="COM_BANNERS_FIELD_CREATED_BY_ALIAS_LABEL" description="COM_BANNERS_FIELD_CREATED_BY_ALIAS_DESC" size="20" /> <field name="modified" type="calendar" label="JGLOBAL_FIELD_MODIFIED_LABEL" description="COM_BANNERS_FIELD_MODIFIED_DESC" class="readonly" size="22" readonly="true" translateformat="true" showtime="true" filter="user_utc" /> <field name="modified_by" type="user" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL" description="COM_BANNERS_FIELD_MODIFIED_BY_DESC" class="readonly" readonly="true" filter="unset" /> <field name="version" type="text" label="COM_BANNERS_FIELD_VERSION_LABEL" description="COM_BANNERS_FIELD_VERSION_DESC" class="readonly" size="6" readonly="true" filter="unset" /> <field name="publish_up" type="calendar" label="COM_BANNERS_FIELD_PUBLISH_UP_LABEL" description="COM_BANNERS_FIELD_PUBLISH_UP_DESC" translateformat="true" showtime="true" size="22" filter="user_utc" /> <field name="publish_down" type="calendar" label="COM_BANNERS_FIELD_PUBLISH_DOWN_LABEL" description="COM_BANNERS_FIELD_PUBLISH_DOWN_DESC" translateformat="true" showtime="true" size="22" filter="user_utc" /> </fieldset> <fieldset name="bannerdetails" label="COM_BANNERS_GROUP_LABEL_BANNER_DETAILS"> <field name="sticky" type="radio" label="COM_BANNERS_FIELD_STICKY_LABEL" description="COM_BANNERS_FIELD_STICKY_DESC" default="0" class="btn-group btn-group-yesno" > <option value="1">JYES</option> <option value="0">JNO</option> </field> </fieldset> <fieldset name="otherparams"> <field name="imptotal" type="imptotal" label="COM_BANNERS_FIELD_IMPTOTAL_LABEL" description="COM_BANNERS_FIELD_IMPTOTAL_DESC" default="0" /> <field name="impmade" type="impmade" label="COM_BANNERS_FIELD_IMPMADE_LABEL" description="COM_BANNERS_FIELD_IMPMADE_DESC" default="0" /> <field name="clicks" type="clicks" label="COM_BANNERS_FIELD_CLICKS_LABEL" description="COM_BANNERS_FIELD_CLICKS_DESC" default="0" /> <field name="cid" type="bannerclient" label="COM_BANNERS_FIELD_CLIENT_LABEL" description="COM_BANNERS_FIELD_CLIENT_DESC" /> <field name="purchase_type" type="list" label="COM_BANNERS_FIELD_PURCHASETYPE_LABEL" description="COM_BANNERS_FIELD_PURCHASETYPE_DESC" default="0" > <option value="-1">COM_BANNERS_FIELD_VALUE_USECLIENTDEFAULT</option> <option value="1">COM_BANNERS_FIELD_VALUE_UNLIMITED</option> <option value="2">COM_BANNERS_FIELD_VALUE_YEARLY</option> <option value="3">COM_BANNERS_FIELD_VALUE_MONTHLY</option> <option value="4">COM_BANNERS_FIELD_VALUE_WEEKLY</option> <option value="5">COM_BANNERS_FIELD_VALUE_DAILY</option> </field> <field name="track_impressions" type="list" label="COM_BANNERS_FIELD_TRACKIMPRESSION_LABEL" description="COM_BANNERS_FIELD_TRACKIMPRESSION_DESC" default="0" > <option value="-1">COM_BANNERS_FIELD_VALUE_USECLIENTDEFAULT</option> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="track_clicks" type="list" label="COM_BANNERS_FIELD_TRACKCLICK_LABEL" description="COM_BANNERS_FIELD_TRACKCLICK_DESC" default="0" > <option value="-1">COM_BANNERS_FIELD_VALUE_USECLIENTDEFAULT</option> <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS"> <field name="metakey" type="textarea" label="JFIELD_META_KEYWORDS_LABEL" description="COM_BANNERS_FIELD_METAKEYWORDS_DESC" rows="3" cols="30" /> <field name="own_prefix" type="radio" label="COM_BANNERS_FIELD_BANNEROWNPREFIX_LABEL" description="COM_BANNERS_FIELD_BANNEROWNPREFIX_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="metakey_prefix" type="text" label="COM_BANNERS_FIELD_METAKEYWORDPREFIX_LABEL" description="COM_BANNERS_FIELD_METAKEYWORDPREFIX_DESC" /> </fieldset> <fields name="params" label="JGLOBAL_FIELDSET_DISPLAY_OPTIONS"> <fieldset name="image"> <field name="imageurl" type="media" label="COM_BANNERS_FIELD_IMAGE_LABEL" description="COM_BANNERS_FIELD_IMAGE_DESC" directory="banners" hide_none="1" size="40" /> <field name="width" type="number" label="COM_BANNERS_FIELD_WIDTH_LABEL" description="COM_BANNERS_FIELD_WIDTH_DESC" class="input-mini validate-numeric" /> <field name="height" type="number" label="COM_BANNERS_FIELD_HEIGHT_LABEL" description="COM_BANNERS_FIELD_HEIGHT_DESC" class="input-mini validate-numeric" /> <field name="alt" type="text" label="COM_BANNERS_FIELD_ALT_LABEL" description="COM_BANNERS_FIELD_ALT_DESC" /> </fieldset> </fields> <fieldset name="custom"> <field name="bannercode" type="textarea" label="COM_BANNERS_FIELD_CUSTOMCODE_LABEL" description="COM_BANNERS_FIELD_CUSTOMCODE_DESC" rows="3" cols="30" filter="raw" /> </fieldset> </form> models/forms/client.xml000064400000007033152326033420011160 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <fieldset name="details" addfieldpath="/administrator/components/com_banners/models/fields"> <field name="id" type="number" label="JGLOBAL_FIELD_ID_LABEL" description="JGLOBAL_FIELD_ID_DESC" default="0" readonly="true" class="readonly" /> <field name="name" type="text" label="COM_BANNERS_FIELD_NAME_LABEL" description="COM_BANNERS_FIELD_CLIENT_NAME_DESC" class="input-xxlarge input-large-text" size="40" required="true" /> <field name="contact" type="text" label="COM_BANNERS_FIELD_CONTACT_LABEL" description="COM_BANNERS_FIELD_CONTACT_DESC" size="40" required="true" /> <field name="email" type="email" label="COM_BANNERS_FIELD_EMAIL_LABEL" description="COM_BANNERS_FIELD_EMAIL_DESC" size="40" validate="email" /> <field name="state" type="list" label="JSTATUS" description="COM_BANNERS_FIELD_CLIENT_STATE_DESC" class="chzn-color-state" size="1" default="1" > <option value="1">JPUBLISHED</option> <option value="0">JUNPUBLISHED</option> <option value="2">JARCHIVED</option> <option value="-2">JTRASHED</option> </field> <field name="version_note" type="text" label="JGLOBAL_FIELD_VERSION_NOTE_LABEL" description="JGLOBAL_FIELD_VERSION_NOTE_DESC" maxlength="255" size="45" labelclass="control-label" /> <field name="purchase_type" type="list" label="COM_BANNERS_FIELD_PURCHASETYPE_LABEL" description="COM_BANNERS_FIELD_PURCHASETYPE_DESC" default="0" > <option value="-1">JGLOBAL_USE_GLOBAL</option> <option value="1">COM_BANNERS_FIELD_VALUE_UNLIMITED</option> <option value="2">COM_BANNERS_FIELD_VALUE_YEARLY</option> <option value="3">COM_BANNERS_FIELD_VALUE_MONTHLY</option> <option value="4">COM_BANNERS_FIELD_VALUE_WEEKLY</option> <option value="5">COM_BANNERS_FIELD_VALUE_DAILY</option> </field> <field name="track_impressions" type="list" label="COM_BANNERS_FIELD_TRACKIMPRESSION_LABEL" description="COM_BANNERS_FIELD_TRACKIMPRESSION_DESC" default="0" class="chzn-color" > <option value="-1">JGLOBAL_USE_GLOBAL</option> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="track_clicks" type="list" label="COM_BANNERS_FIELD_TRACKCLICK_LABEL" description="COM_BANNERS_FIELD_TRACKCLICK_DESC" default="0" class="chzn-color" > <option value="-1">JGLOBAL_USE_GLOBAL</option> <option value="0">JNO</option> <option value="1">JYES</option> </field> </fieldset> <fieldset name="metadata" label="JGLOBAL_FIELDSET_METADATA_OPTIONS"> <field name="metakey" type="textarea" label="JFIELD_META_KEYWORDS_LABEL" description="COM_BANNERS_FIELD_CLIENT_METAKEYWORDS_DESC" rows="3" cols="30" /> <field name="own_prefix" type="radio" label="COM_BANNERS_FIELD_CLIENTOWNPREFIX_LABEL" description="COM_BANNERS_FIELD_CLIENTOWNPREFIX_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="metakey_prefix" type="text" label="COM_BANNERS_FIELD_CLIENT_METAKEYWORDPREFIX_LABEL" description="COM_BANNERS_FIELD_CLIENT_METAKEYWORDPREFIX_DESC" /> </fieldset> <fieldset name="extra" label="COM_BANNERS_EXTRA"> <field name="extrainfo" type="textarea" label="COM_BANNERS_FIELD_EXTRAINFO_LABEL" description="COM_BANNERS_FIELD_EXTRAINFO_DESC" class="span12" rows="5" cols="80" /> </fieldset> </form> models/forms/download.xml000064400000001145152326033420011507 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <fieldset name="details"> <field name="compressed" type="radio" label="COM_BANNERS_FIELD_COMPRESSED_LABEL" description="COM_BANNERS_FIELD_COMPRESSED_DESC" default="0" class="btn-group btn-group-yesno" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="basename" type="text" label="COM_BANNERS_FIELD_BASENAME_LABEL" size="40" /> <field name="basename_info" type="note" description="COM_BANNERS_FIELD_BASENAME_DESC" class="alert alert-info" /> </fieldset> </form> models/forms/filter_banners.xml000064400000006732152326033420012704 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <fields name="filter" addfieldpath="/administrator/components/com_banners/models/fields"> <field name="search" type="text" inputmode="search" label="COM_BANNERS_BANNERS_FILTER_SEARCH_LABEL" description="COM_BANNERS_BANNERS_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" /> <field name="published" type="status" label="JOPTION_SELECT_PUBLISHED" description="JOPTION_SELECT_PUBLISHED_DESC" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_PUBLISHED</option> </field> <field name="category_id" type="category" label="JOPTION_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" extension="com_banners" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_CATEGORY</option> </field> <field name="client_id" type="bannerclient" label="COM_BANNERS_FILTER_CLIENT" description="COM_BANNERS_FILTER_CLIENT_DESC" extension="com_content" onchange="this.form.submit();" > <option value="">COM_BANNERS_SELECT_CLIENT</option> </field> <field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_LANGUAGE</option> <option value="*">JALL</option> </field> <field name="level" type="integer" label="JOPTION_FILTER_LEVEL" description="JOPTION_FILTER_LEVEL_DESC" first="1" last="10" step="1" languages="*" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_MAX_LEVELS</option> </field> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" description="JGLOBAL_SORT_BY" statuses="*,0,1,2,-2" onchange="this.form.submit();" default="a.name ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option> <option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option> <option value="a.state ASC">JSTATUS_ASC</option> <option value="a.state DESC">JSTATUS_DESC</option> <option value="a.name ASC">COM_BANNERS_HEADING_NAME_ASC</option> <option value="a.name DESC">COM_BANNERS_HEADING_NAME_DESC</option> <option value="category_title ASC">JCATEGORY_ASC</option> <option value="category_title DESC">JCATEGORY_DESC</option> <option value="a.sticky ASC">COM_BANNERS_HEADING_STICKY_ASC</option> <option value="a.sticky DESC">COM_BANNERS_HEADING_STICKY_DESC</option> <option value="client_name ASC">COM_BANNERS_HEADING_CLIENT_ASC</option> <option value="client_name DESC">COM_BANNERS_HEADING_CLIENT_DESC</option> <option value="impmade ASC">COM_BANNERS_HEADING_IMPRESSIONS_ASC</option> <option value="impmade DESC">COM_BANNERS_HEADING_IMPRESSIONS_DESC</option> <option value="clicks ASC">COM_BANNERS_HEADING_CLICKS_ASC</option> <option value="clicks DESC">COM_BANNERS_HEADING_CLICKS_DESC</option> <option value="a.language ASC">JGRID_HEADING_LANGUAGE_ASC</option> <option value="a.language DESC">JGRID_HEADING_LANGUAGE_DESC</option> <option value="a.id ASC">JGRID_HEADING_ID_ASC</option> <option value="a.id DESC">JGRID_HEADING_ID_DESC</option> </field> <field name="limit" type="limitbox" label="COM_BANNERS_LIST_LIMIT" description="COM_BANNERS_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> models/forms/filter_clients.xml000064400000004363152326033420012713 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <fields name="filter"> <field name="search" type="text" inputmode="search" label="COM_BANNERS_CLIENTS_FILTER_SEARCH_LABEL" description="COM_BANNERS_CLIENTS_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" /> <field name="state" type="status" label="JOPTION_SELECT_PUBLISHED" description="JOPTION_SELECT_PUBLISHED_DESC" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_PUBLISHED</option> </field> <field name="purchase_type" type="list" label="COM_BANNERS_FILTER_PURCHASETYPE_LABEL" description="COM_BANNERS_FIELD_PURCHASETYPE_DESC" default="0" onchange="this.form.submit();" > <option value="">COM_BANNERS_SELECT_TYPE</option> <option value="1">COM_BANNERS_FIELD_VALUE_UNLIMITED</option> <option value="2">COM_BANNERS_FIELD_VALUE_YEARLY</option> <option value="3">COM_BANNERS_FIELD_VALUE_MONTHLY</option> <option value="4">COM_BANNERS_FIELD_VALUE_WEEKLY</option> <option value="5">COM_BANNERS_FIELD_VALUE_DAILY</option> </field> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" description="JGLOBAL_SORT_BY" statuses="*,0,1,2,-2" onchange="this.form.submit();" default="a.name ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="a.state ASC">JSTATUS_ASC</option> <option value="a.state DESC">JSTATUS_DESC</option> <option value="a.name ASC">COM_BANNERS_HEADING_CLIENT_ASC</option> <option value="a.name DESC">COM_BANNERS_HEADING_CLIENT_DESC</option> <option value="a.contact ASC">COM_BANNERS_HEADING_CONTACT_ASC</option> <option value="a.contact DESC">COM_BANNERS_HEADING_CONTACT_DESC</option> <option value="a.purchase_type ASC">COM_BANNERS_HEADING_PURCHASETYPE_ASC</option> <option value="a.purchase_type DESC">COM_BANNERS_HEADING_PURCHASETYPE_DESC</option> <option value="a.id ASC">JGRID_HEADING_ID_ASC</option> <option value="a.id DESC">JGRID_HEADING_ID_DESC</option> </field> <field name="limit" type="limitbox" label="COM_BANNERS_LIST_LIMIT" description="COM_BANNERS_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" /> </fields> </form> models/forms/filter_tracks.xml000064400000005631152326033420012540 0ustar00<?xml version="1.0" encoding="utf-8"?> <form> <fields name="filter" addfieldpath="/administrator/components/com_banners/models/fields"> <field name="search" type="text" inputmode="search" label="COM_BANNERS_TRACKS_FILTER_SEARCH_LABEL" description="COM_BANNERS_TRACKS_FILTER_SEARCH_DESC" hint="JSEARCH_FILTER" /> <field name="category_id" type="category" label="JOPTION_FILTER_CATEGORY" description="JOPTION_FILTER_CATEGORY_DESC" extension="com_banners" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_CATEGORY</option> </field> <field name="client_id" type="bannerclient" label="COM_BANNERS_FILTER_CLIENT" description="COM_BANNERS_FILTER_CLIENT_DESC" extension="com_content" onchange="this.form.submit();" > <option value="">COM_BANNERS_SELECT_CLIENT</option> </field> <field name="type" type="list" onchange="this.form.submit();" > <option value="">COM_BANNERS_SELECT_TYPE</option> <option value="1">COM_BANNERS_TYPE1</option> <option value="2">COM_BANNERS_TYPE2</option> </field> <field name="level" type="integer" label="JOPTION_FILTER_LEVEL" description="JOPTION_FILTER_LEVEL_DESC" first="1" last="10" step="1" languages="*" onchange="this.form.submit();" > <option value="">JOPTION_SELECT_MAX_LEVELS</option> </field> <field name="begin" type="calendar" label="COM_BANNERS_BEGIN_LABEL" description="COM_BANNERS_BEGIN_DESC" hint="COM_BANNERS_BEGIN_HINT" format="%Y-%m-%d" size="10" filter="user_utc" /> <field name="end" type="calendar" label="COM_BANNERS_END_LABEL" description="COM_BANNERS_END_DESC" hint="COM_BANNERS_END_HINT" format="%Y-%m-%d" size="10" filter="user_utc" /> </fields> <fields name="list"> <field name="fullordering" type="list" label="JGLOBAL_SORT_BY" description="JGLOBAL_SORT_BY" onchange="this.form.submit();" default="b.name ASC" validate="options" > <option value="">JGLOBAL_SORT_BY</option> <option value="b.name ASC">COM_BANNERS_HEADING_NAME_ASC</option> <option value="b.name DESC">COM_BANNERS_HEADING_NAME_DESC</option> <option value="cl.name ASC">COM_BANNERS_HEADING_CLIENT_ASC</option> <option value="cl.name DESC">COM_BANNERS_HEADING_CLIENT_DESC</option> <option value="a.track_type ASC">COM_BANNERS_HEADING_TYPE_ASC</option> <option value="a.track_type DESC">COM_BANNERS_HEADING_TYPE_DESC</option> <option value="a.count ASC">COM_BANNERS_HEADING_COUNT_ASC</option> <option value="a.count DESC">COM_BANNERS_HEADING_COUNT_DESC</option> <option value="a.track_date ASC">JDATE_ASC</option> <option value="a.track_date DESC">JDATE_DESC</option> </field> <field name="limit" type="limitbox" label="JGLOBAL_LIMIT" description="JGLOBAL_LIMIT" class="input-mini" default="5" onchange="this.form.submit();" /> </fields> </form> models/forms/index.html000064400000000037152326033420011152 0ustar00<!DOCTYPE html><title></title> models/banner.php000064400000027606152326033420010020 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Banner model. * * @since 1.6 */ class BannersModelBanner extends JModelAdmin { /** * The prefix to use with controller messages. * * @var string * @since 1.6 */ protected $text_prefix = 'COM_BANNERS_BANNER'; /** * The type alias for this content type. * * @var string * @since 3.2 */ public $typeAlias = 'com_banners.banner'; /** * Batch copy/move command. If set to false, the batch copy/move command is not supported * * @var string */ protected $batch_copymove = 'category_id'; /** * Allowed batch commands * * @var array */ protected $batch_commands = array( 'client_id' => 'batchClient', 'language_id' => 'batchLanguage' ); /** * Batch client changes for a group of banners. * * @param string $value The new value matching a client. * @param array $pks An array of row IDs. * @param array $contexts An array of item contexts. * * @return boolean True if successful, false otherwise and internal error is set. * * @since 2.5 */ protected function batchClient($value, $pks, $contexts) { // Set the variables $user = JFactory::getUser(); /** @var BannersTableBanner $table */ $table = $this->getTable(); foreach ($pks as $pk) { if (!$user->authorise('core.edit', $contexts[$pk])) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); return false; } $table->reset(); $table->load($pk); $table->cid = (int) $value; if (!$table->store()) { $this->setError($table->getError()); return false; } } // Clean the cache $this->cleanCache(); return true; } /** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canDelete($record) { if (empty($record->id) || $record->state != -2) { return false; } if (!empty($record->catid)) { return JFactory::getUser()->authorise('core.delete', 'com_banners.category.' . (int) $record->catid); } return parent::canDelete($record); } /** * A method to preprocess generating a new title in order to allow tables with alternative names * for alias and title to use the batch move and copy methods * * @param integer $categoryId The target category id * @param JTable $table The JTable within which move or copy is taking place * * @return void * * @since 3.8.12 */ public function generateTitle($categoryId, $table) { // Alter the title & alias $data = $this->generateNewTitle($categoryId, $table->alias, $table->name); $table->name = $data['0']; $table->alias = $data['1']; } /** * Method to test whether a record can have its state changed. * * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canEditState($record) { // Check against the category. if (!empty($record->catid)) { return JFactory::getUser()->authorise('core.edit.state', 'com_banners.category.' . (int) $record->catid); } // Default to component settings if category not known. return parent::canEditState($record); } /** * Returns a JTable object, always creating it. * * @param string $type The table type to instantiate. [optional] * @param string $prefix A prefix for the table class name. [optional] * @param array $config Configuration array for model. [optional] * * @return JTable A database object * * @since 1.6 */ public function getTable($type = 'Banner', $prefix = 'BannersTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); } /** * Method to get the record form. * * @param array $data Data for the form. [optional] * @param boolean $loadData True if the form is to load its own data (default case), false if not. [optional] * * @return JForm|boolean 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_banners.banner', 'banner', array('control' => 'jform', 'load_data' => $loadData)); if (empty($form)) { return false; } // Determine correct permissions to check. if ($this->getState('banner.id')) { // Existing record. Can only edit in selected categories. $form->setFieldAttribute('catid', 'action', 'core.edit'); } else { // New record. Can only create in selected categories. $form->setFieldAttribute('catid', 'action', 'core.create'); } // Modify the form based on access controls. if (!$this->canEditState((object) $data)) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('publish_up', 'disabled', 'true'); $form->setFieldAttribute('publish_down', 'disabled', 'true'); $form->setFieldAttribute('state', 'disabled', 'true'); $form->setFieldAttribute('sticky', 'disabled', 'true'); // Disable fields while saving. // The controller has already verified this is a record you can edit. $form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('publish_up', 'filter', 'unset'); $form->setFieldAttribute('publish_down', 'filter', 'unset'); $form->setFieldAttribute('state', 'filter', 'unset'); $form->setFieldAttribute('sticky', 'filter', 'unset'); } 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. $app = JFactory::getApplication(); $data = $app->getUserState('com_banners.edit.banner.data', array()); if (empty($data)) { $data = $this->getItem(); // Prime some default values. if ($this->getState('banner.id') == 0) { $filters = (array) $app->getUserState('com_banners.banners.filter'); $filterCatId = isset($filters['category_id']) ? $filters['category_id'] : null; $data->set('catid', $app->input->getInt('catid', $filterCatId)); } } $this->preprocessData('com_banners.banner', $data); return $data; } /** * Method to stick records. * * @param array $pks The ids of the items to publish. * @param integer $value The value of the published state * * @return boolean True on success. * * @since 1.6 */ public function stick(&$pks, $value = 1) { /** @var BannersTableBanner $table */ $table = $this->getTable(); $pks = (array) $pks; // Access checks. foreach ($pks as $i => $pk) { if ($table->load($pk)) { if (!$this->canEditState($table)) { // Prune items that you can't change. unset($pks[$i]); JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); } } } // Attempt to change the state of the records. if (!$table->stick($pks, $value, JFactory::getUser()->id)) { $this->setError($table->getError()); return false; } return true; } /** * A protected method to get a set of ordering conditions. * * @param JTable $table A record object. * * @return array An array of conditions to add to add to ordering queries. * * @since 1.6 */ protected function getReorderConditions($table) { return array( 'catid = ' . (int) $table->catid, 'state >= 0' ); } /** * Prepare and sanitise the table prior to saving. * * @param JTable $table A JTable object. * * @return void * * @since 1.6 */ protected function prepareTable($table) { $date = JFactory::getDate(); $user = JFactory::getUser(); if (empty($table->id)) { // Set the values $table->created = $date->toSql(); $table->created_by = $user->id; // Set ordering to the last item if not set if (empty($table->ordering)) { $db = $this->getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering)') ->from('#__banners'); $db->setQuery($query); $max = $db->loadResult(); $table->ordering = $max + 1; } } else { // Set the values $table->modified = $date->toSql(); $table->modified_by = $user->id; } // Increment the content version number. $table->version++; } /** * Allows preprocessing of the JForm object. * * @param JForm $form The form object * @param array $data The data to be merged into the form object * @param string $group The plugin group to be executed * * @return void * * @since 3.6.1 */ protected function preprocessForm(JForm $form, $data, $group = 'content') { if ($this->canCreateCategory()) { $form->setFieldAttribute('catid', 'allowAdd', 'true'); // Add a prefix for categories created on the fly. $form->setFieldAttribute('catid', 'customPrefix', '#new#'); } parent::preprocessForm($form, $data, $group); } /** * Method to save the form data. * * @param array $data The form data. * * @return boolean True on success. * * @since 1.6 */ public function save($data) { $input = JFactory::getApplication()->input; JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); // Create new category, if needed. $createCategory = true; // If category ID is provided, check if it's valid. if (is_numeric($data['catid']) && $data['catid']) { $createCategory = !CategoriesHelper::validateCategoryId($data['catid'], 'com_banners'); } // Save New Category if ($createCategory && $this->canCreateCategory()) { $table = array(); // Remove #new# prefix, if exists. $table['title'] = strpos($data['catid'], '#new#') === 0 ? substr($data['catid'], 5) : $data['catid']; $table['parent_id'] = 1; $table['extension'] = 'com_banners'; $table['language'] = $data['language']; $table['published'] = 1; // Create new category and get catid back $data['catid'] = CategoriesHelper::createCategory($table); } // Alter the name for save as copy if ($input->get('task') == 'save2copy') { /** @var BannersTableBanner $origTable */ $origTable = clone $this->getTable(); $origTable->load($input->getInt('id')); if ($data['name'] == $origTable->name) { list($name, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['name']); $data['name'] = $name; $data['alias'] = $alias; } else { if ($data['alias'] == $origTable->alias) { $data['alias'] = ''; } } $data['state'] = 0; } return parent::save($data); } /** * Is the user allowed to create an on the fly category? * * @return boolean * * @since 3.6.1 */ private function canCreateCategory() { return JFactory::getUser()->authorise('core.create', 'com_banners'); } /** * Method to validate the form data. * * @param JForm $form The form to validate against. * @param array $data The data to validate. * @param string $group The name of the field group to validate. * * @return array|boolean Array of filtered data if valid, false otherwise. * * @see JFormRule * @see JFilterInput * @since 3.9.25 */ public function validate($form, $data, $group = null) { // Don't allow to change the users if not allowed to access com_users. if (!JFactory::getUser()->authorise('core.manage', 'com_users')) { if (isset($data['created_by'])) { unset($data['created_by']); } } return parent::validate($form, $data, $group); } } models/banners.php000064400000017653152326033420010204 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Methods supporting a list of banner records. * * @since 1.6 */ class BannersModelBanners extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'cid', 'a.cid', 'client_name', 'name', 'a.name', 'alias', 'a.alias', 'state', 'a.state', 'ordering', 'a.ordering', 'language', 'a.language', 'catid', 'a.catid', 'category_title', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'created', 'a.created', 'impmade', 'a.impmade', 'imptotal', 'a.imptotal', 'clicks', 'a.clicks', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'sticky', 'a.sticky', 'client_id', 'category_id', 'published', 'level', 'c.level', ); } parent::__construct($config); } /** * Method to get the maximum ordering value for each category. * * @return array * * @since 1.6 */ public function &getCategoryOrders() { if (!isset($this->cache['categoryorders'])) { $db = $this->getDbo(); $query = $db->getQuery(true) ->select('MAX(ordering) as ' . $db->quoteName('max') . ', catid') ->select('catid') ->from('#__banners') ->group('catid'); $db->setQuery($query); $this->cache['categoryorders'] = $db->loadAssocList('catid', 0); } return $this->cache['categoryorders']; } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery * * @since 1.6 */ protected function getListQuery() { $db = $this->getDbo(); $query = $db->getQuery(true); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.id AS id,' . 'a.name AS name,' . 'a.alias AS alias,' . 'a.checked_out AS checked_out,' . 'a.checked_out_time AS checked_out_time,' . 'a.catid AS catid,' . 'a.clicks AS clicks,' . 'a.metakey AS metakey,' . 'a.sticky AS sticky,' . 'a.impmade AS impmade,' . 'a.imptotal AS imptotal,' . 'a.state AS state,' . 'a.ordering AS ordering,' . 'a.purchase_type AS purchase_type,' . 'a.language,' . 'a.publish_up,' . 'a.publish_down' ) ); $query->from($db->quoteName('#__banners', 'a')); // Join over the language $query->select('l.title AS language_title, l.image AS language_image') ->join('LEFT', $db->quoteName('#__languages', 'l') . ' ON l.lang_code = a.language'); // Join over the users for the checked out user. $query->select($db->quoteName('uc.name', 'editor')) ->join('LEFT', $db->quoteName('#__users', 'uc') . ' ON uc.id = a.checked_out'); // Join over the categories. $query->select($db->quoteName('c.title', 'category_title')) ->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON c.id = a.catid'); // Join over the clients. $query->select($db->quoteName('cl.name', 'client_name')) ->select($db->quoteName('cl.purchase_type', 'client_purchase_type')) ->join('LEFT', $db->quoteName('#__banner_clients', 'cl') . ' ON cl.id = a.cid'); // Filter by published state $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where($db->quoteName('a.state') . ' = ' . (int) $published); } elseif ($published === '') { $query->where($db->quoteName('a.state') . ' IN (0, 1)'); } // Filter by category. $categoryId = $this->getState('filter.category_id'); if (is_numeric($categoryId)) { $query->where($db->quoteName('a.catid') . ' = ' . (int) $categoryId); } // Filter by client. $clientId = $this->getState('filter.client_id'); if (is_numeric($clientId)) { $query->where($db->quoteName('a.cid') . ' = ' . (int) $clientId); } // Filter by search in title $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3)); } else { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where('(a.name LIKE ' . $search . ' OR a.alias LIKE ' . $search . ')'); } } // Filter on the language. if ($language = $this->getState('filter.language')) { $query->where($db->quoteName('a.language') . ' = ' . $db->quote($language)); } // Filter on the level. if ($level = $this->getState('filter.level')) { $query->where($db->quoteName('c.level') . ' <= ' . (int) $level); } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.name'); $orderDirn = $this->state->get('list.direction', 'ASC'); if ($orderCol == 'a.ordering' || $orderCol == 'category_title') { $orderCol = 'c.title ' . $orderDirn . ', a.ordering'; } if ($orderCol == 'client_name') { $orderCol = 'cl.name'; } $query->order($db->escape($orderCol . ' ' . $orderDirn)); return $query; } /** * 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 $id A prefix for the store id. * * @return string A store id. * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.category_id'); $id .= ':' . $this->getState('filter.client_id'); $id .= ':' . $this->getState('filter.language'); $id .= ':' . $this->getState('filter.level'); return parent::getStoreId($id); } /** * Returns a reference to the a Table object, always creating it. * * @param string $type The table type to instantiate * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * * @return JTable A JTable object * * @since 1.6 */ public function getTable($type = 'Banner', $prefix = 'BannersTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'a.name', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.published', $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '', 'string')); $this->setState('filter.category_id', $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', '', 'cmd')); $this->setState('filter.client_id', $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', '', 'cmd')); $this->setState('filter.language', $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '', 'string')); $this->setState('filter.level', $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', '', 'cmd')); // Load the parameters. $this->setState('params', JComponentHelper::getParams('com_banners')); // List state information. parent::populateState($ordering, $direction); } } models/client.php000064400000006522152326033420010023 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Client model. * * @since 1.6 */ class BannersModelClient extends JModelAdmin { /** * The type alias for this content type. * * @var string * @since 3.2 */ public $typeAlias = 'com_banners.client'; /** * Method to test whether a record can be deleted. * * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. * * @since 1.6 */ protected function canDelete($record) { if (empty($record->id) || $record->state != -2) { return false; } if (!empty($record->catid)) { return JFactory::getUser()->authorise('core.delete', 'com_banners.category.' . (int) $record->catid); } return parent::canDelete($record); } /** * Method to test whether a record can have its state changed. * * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. * Defaults to the permission set in the component. * * @since 1.6 */ protected function canEditState($record) { $user = JFactory::getUser(); if (!empty($record->catid)) { return $user->authorise('core.edit.state', 'com_banners.category.' . (int) $record->catid); } return $user->authorise('core.edit.state', 'com_banners'); } /** * Returns a reference to the a Table object, always creating it. * * @param string $type The table type to instantiate * @param string $prefix A prefix for the table class name. Optional. * @param array $config Configuration array for model. Optional. * * @return JTable A JTable object * * @since 1.6 */ public function getTable($type = 'Client', $prefix = 'BannersTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); } /** * 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|boolean 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_banners.client', 'client', 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_banners.edit.client.data', array()); if (empty($data)) { $data = $this->getItem(); } $this->preprocessData('com_banners.client', $data); return $data; } /** * Prepare and sanitise the table prior to saving. * * @param JTable $table A JTable object. * * @return void * * @since 1.6 */ protected function prepareTable($table) { $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); } } models/clients.php000064400000017214152326033420010206 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Methods supporting a list of banner records. * * @since 1.6 */ class BannersModelClients extends JModelList { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'name', 'a.name', 'contact', 'a.contact', 'state', 'a.state', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'purchase_type', 'a.purchase_type' ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'a.name', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string')); $this->setState('filter.purchase_type', $this->getUserStateFromRequest($this->context . '.filter.purchase_type', 'filter_purchase_type')); // Load the parameters. $this->setState('params', JComponentHelper::getParams('com_banners')); // List state information. parent::populateState($ordering, $direction); } /** * 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 $id 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'); $id .= ':' . $this->getState('filter.purchase_type'); 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); $defaultPurchase = JComponentHelper::getParams('com_banners')->get('purchase_type', 3); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.id AS id,' . 'a.name AS name,' . 'a.contact AS contact,' . 'a.checked_out AS checked_out,' . 'a.checked_out_time AS checked_out_time, ' . 'a.state AS state,' . 'a.metakey AS metakey,' . 'a.purchase_type as purchase_type' ) ); $query->from($db->quoteName('#__banner_clients') . ' AS a'); // Join over the banners for counting $query->select('COUNT(b.id) as nbanners') ->join('LEFT', '#__banners AS b ON a.id = b.cid'); // Join over the users for the checked out user. $query->select('uc.name AS editor') ->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); // Filter by published state $published = $this->getState('filter.state'); if (is_numeric($published)) { $query->where('a.state = ' . (int) $published); } elseif ($published === '') { $query->where('(a.state IN (0, 1))'); } $query->group('a.id, a.name, a.contact, a.checked_out, a.checked_out_time, a.state, a.metakey, a.purchase_type, uc.name'); // Filter by search in title $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = ' . (int) substr($search, 3)); } else { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where('a.name LIKE ' . $search); } } // Filter by purchase type $purchaseType = $this->getState('filter.purchase_type'); if (!empty($purchaseType)) { if ($defaultPurchase == $purchaseType) { $query->where('(a.purchase_type = ' . (int) $purchaseType . ' OR a.purchase_type = -1)'); } else { $query->where('a.purchase_type = ' . (int) $purchaseType); } } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.name')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Overrides the getItems method to attach additional metrics to the list. * * @return mixed An array of data items on success, false on failure. * * @since 3.6 */ public function getItems() { // Get a storage key. $store = $this->getStoreId('getItems'); // Try to load the data from internal storage. if (!empty($this->cache[$store])) { return $this->cache[$store]; } // Load the list items. $items = parent::getItems(); // If empty or an error, just return. if (empty($items)) { return array(); } // Getting the following metric by joins is WAY TOO SLOW. // Faster to do three queries for very large banner trees. // Get the clients in the list. $db = $this->getDbo(); $clientIds = ArrayHelper::getColumn($items, 'id'); // Quote the strings. $clientIds = implode( ',', array_map(array($db, 'quote'), $clientIds) ); // Get the published banners count. $query = $db->getQuery(true) ->select('cid, COUNT(cid) AS count_published') ->from('#__banners') ->where('state = 1') ->where('cid IN (' . $clientIds . ')') ->group('cid'); $db->setQuery($query); try { $countPublished = $db->loadAssocList('cid', 'count_published'); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } // Get the unpublished banners count. $query->clear('where') ->where('state = 0') ->where('cid IN (' . $clientIds . ')'); $db->setQuery($query); try { $countUnpublished = $db->loadAssocList('cid', 'count_published'); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } // Get the trashed banners count. $query->clear('where') ->where('state = -2') ->where('cid IN (' . $clientIds . ')'); $db->setQuery($query); try { $countTrashed = $db->loadAssocList('cid', 'count_published'); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } // Get the archived banners count. $query->clear('where') ->where('state = 2') ->where('cid IN (' . $clientIds . ')'); $db->setQuery($query); try { $countArchived = $db->loadAssocList('cid', 'count_published'); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } // Inject the values back into the array. foreach ($items as $item) { $item->count_published = isset($countPublished[$item->id]) ? $countPublished[$item->id] : 0; $item->count_unpublished = isset($countUnpublished[$item->id]) ? $countUnpublished[$item->id] : 0; $item->count_trashed = isset($countTrashed[$item->id]) ? $countTrashed[$item->id] : 0; $item->count_archived = isset($countArchived[$item->id]) ? $countArchived[$item->id] : 0; } // Add the items to the internal cache. $this->cache[$store] = $items; return $this->cache[$store]; } } models/download.php000064400000003574152326033420010360 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Download model. * * @since 1.5 */ class BannersModelDownload extends JModelForm { /** * The model context * * @var string */ protected $_context = 'com_banners.tracks'; /** * Auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState() { $input = JFactory::getApplication()->input; $this->setState('basename', $input->cookie->getString(JApplicationHelper::getHash($this->_context . '.basename'), '__SITE__')); $this->setState('compressed', $input->cookie->getInt(JApplicationHelper::getHash($this->_context . '.compressed'), 1)); } /** * 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|boolean 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_banners.download', 'download', 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() { $data = (object) array( 'basename' => $this->getState('basename'), 'compressed' => $this->getState('compressed'), ); $this->preprocessData('com_banners.download', $data); return $data; } } models/index.html000064400000000037152326033420010024 0ustar00<!DOCTYPE html><title></title> models/tracks.php000064400000031761152326033420010037 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Archive\Archive; use Joomla\String\StringHelper; JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * Methods supporting a list of tracks. * * @since 1.6 */ class BannersModelTracks extends JModelList { /** * The base name * * @var string * @since 1.6 */ protected $basename; /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'b.name', 'banner_name', 'cl.name', 'client_name', 'client_id', 'c.title', 'category_title', 'category_id', 'track_type', 'a.track_type', 'type', 'count', 'a.count', 'track_date', 'a.track_date', 'end', 'begin', 'level', 'c.level', ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = 'b.name', $direction = 'asc') { // Load the filter state. $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('filter.category_id', $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', '', 'cmd')); $this->setState('filter.client_id', $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', '', 'cmd')); $this->setState('filter.type', $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '', 'cmd')); $this->setState('filter.level', $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', '', 'cmd')); $this->setState('filter.begin', $this->getUserStateFromRequest($this->context . '.filter.begin', 'filter_begin', '', 'string')); $this->setState('filter.end', $this->getUserStateFromRequest($this->context . '.filter.end', 'filter_end', '', 'string')); // Load the parameters. $this->setState('params', JComponentHelper::getParams('com_banners')); // List state information. parent::populateState($ordering, $direction); } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery * * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select the required fields from the table. $query->select($db->quoteName(array('a.track_date', 'a.track_type', 'a.count'))) ->select($db->quoteName('b.name', 'banner_name')) ->select($db->quoteName('cl.name', 'client_name')) ->select($db->quoteName('c.title', 'category_title')); // From tracks table. $query->from($db->quoteName('#__banner_tracks', 'a')); // Join with the banners. $query->join('LEFT', $db->quoteName('#__banners', 'b') . ' ON ' . $db->quoteName('b.id') . ' = ' . $db->quoteName('a.banner_id')); // Join with the client. $query->join('LEFT', $db->quoteName('#__banner_clients', 'cl') . ' ON ' . $db->quoteName('cl.id') . ' = ' . $db->quoteName('b.cid')); // Join with the category. $query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON ' . $db->quoteName('c.id') . ' = ' . $db->quoteName('b.catid')); // Filter by type. $type = $this->getState('filter.type'); if (!empty($type)) { $query->where($db->quoteName('a.track_type') . ' = ' . (int) $type); } // Filter by client. $clientId = $this->getState('filter.client_id'); if (is_numeric($clientId)) { $query->where($db->quoteName('b.cid') . ' = ' . (int) $clientId); } // Filter by category. $categoryId = $this->getState('filter.category_id'); if (is_numeric($categoryId)) { $query->where($db->quoteName('b.catid') . ' = ' . (int) $categoryId); } // Filter by begin date. $begin = $this->getState('filter.begin'); if (!empty($begin)) { $query->where($db->quoteName('a.track_date') . ' >= ' . $db->quote($begin)); } // Filter by end date. $end = $this->getState('filter.end'); if (!empty($end)) { $query->where($db->quoteName('a.track_date') . ' <= ' . $db->quote($end)); } // Filter on the level. if ($level = $this->getState('filter.level')) { $query->where($db->quoteName('c.level') . ' <= ' . (int) $level); } // Filter by search in banner name or client name. $search = $this->getState('filter.search'); if (!empty($search)) { $search = $db->quote('%' . StringHelper::strtolower($search) . '%'); $query->where('(LOWER(b.name) LIKE ' . $search . ' OR LOWER(cl.name) LIKE ' . $search . ')'); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'b.name')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } /** * Method to delete rows. * * @return boolean Returns true on success, false on failure. */ public function delete() { $user = JFactory::getUser(); $categoryId = $this->getState('category_id'); // Access checks. if ($categoryId) { $allow = $user->authorise('core.delete', 'com_banners.category.' . (int) $categoryId); } else { $allow = $user->authorise('core.delete', 'com_banners'); } if ($allow) { // Delete tracks from this banner $db = $this->getDbo(); $query = $db->getQuery(true) ->delete($db->quoteName('#__banner_tracks')); // Filter by type $type = $this->getState('filter.type'); if (!empty($type)) { $query->where('track_type = ' . (int) $type); } // Filter by begin date $begin = $this->getState('filter.begin'); if (!empty($begin)) { $query->where('track_date >= ' . $db->quote($begin)); } // Filter by end date $end = $this->getState('filter.end'); if (!empty($end)) { $query->where('track_date <= ' . $db->quote($end)); } $where = '1 = 1'; // Filter by client $clientId = $this->getState('filter.client_id'); if (!empty($clientId)) { $where .= ' AND cid = ' . (int) $clientId; } // Filter by category if (!empty($categoryId)) { $where .= ' AND catid = ' . (int) $categoryId; } $query->where('banner_id IN (SELECT id FROM ' . $db->quoteName('#__banners') . ' WHERE ' . $where . ')'); $db->setQuery($query); $this->setError((string) $query); try { $db->execute(); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } } else { JError::raiseWarning(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); } return true; } /** * Get file name * * @return string The file name * * @since 1.6 */ public function getBaseName() { if (!isset($this->basename)) { $basename = str_replace('__SITE__', JFactory::getApplication()->get('sitename'), $this->getState('basename')); $categoryId = $this->getState('filter.category_id'); if (is_numeric($categoryId)) { if ($categoryId > 0) { $basename = str_replace('__CATID__', $categoryId, $basename); } else { $basename = str_replace('__CATID__', '', $basename); } $categoryName = $this->getCategoryName(); $basename = str_replace('__CATNAME__', $categoryName, $basename); } else { $basename = str_replace(array('__CATID__', '__CATNAME__'), '', $basename); } $clientId = $this->getState('filter.client_id'); if (is_numeric($clientId)) { if ($clientId > 0) { $basename = str_replace('__CLIENTID__', $clientId, $basename); } else { $basename = str_replace('__CLIENTID__', '', $basename); } $clientName = $this->getClientName(); $basename = str_replace('__CLIENTNAME__', $clientName, $basename); } else { $basename = str_replace(array('__CLIENTID__', '__CLIENTNAME__'), '', $basename); } $type = $this->getState('filter.type'); if ($type > 0) { $basename = str_replace('__TYPE__', $type, $basename); $typeName = JText::_('COM_BANNERS_TYPE' . $type); $basename = str_replace('__TYPENAME__', $typeName, $basename); } else { $basename = str_replace(array('__TYPE__', '__TYPENAME__'), '', $basename); } $begin = $this->getState('filter.begin'); if (!empty($begin)) { $basename = str_replace('__BEGIN__', $begin, $basename); } else { $basename = str_replace('__BEGIN__', '', $basename); } $end = $this->getState('filter.end'); if (!empty($end)) { $basename = str_replace('__END__', $end, $basename); } else { $basename = str_replace('__END__', '', $basename); } $this->basename = $basename; } return $this->basename; } /** * Get the category name. * * @return string The category name * * @since 1.6 */ protected function getCategoryName() { $categoryId = $this->getState('filter.category_id'); if ($categoryId) { $db = $this->getDbo(); $query = $db->getQuery(true) ->select('title') ->from($db->quoteName('#__categories')) ->where($db->quoteName('id') . '=' . $db->quote($categoryId)); $db->setQuery($query); try { $name = $db->loadResult(); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } return $name; } return JText::_('COM_BANNERS_NOCATEGORYNAME'); } /** * Get the client name * * @return string The client name. * * @since 1.6 */ protected function getClientName() { $clientId = $this->getState('filter.client_id'); if ($clientId) { $db = $this->getDbo(); $query = $db->getQuery(true) ->select('name') ->from($db->quoteName('#__banner_clients')) ->where($db->quoteName('id') . '=' . $db->quote($clientId)); $db->setQuery($query); try { $name = $db->loadResult(); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } return $name; } return JText::_('COM_BANNERS_NOCLIENTNAME'); } /** * Get the file type. * * @return string The file type * * @since 1.6 */ public function getFileType() { return $this->getState('compressed') ? 'zip' : 'csv'; } /** * Get the mime type. * * @return string The mime type. * * @since 1.6 */ public function getMimeType() { return $this->getState('compressed') ? 'application/zip' : 'text/csv'; } /** * Get the content * * @return string The content. * * @since 1.6 */ public function getContent() { if (!isset($this->content)) { $this->content = '"' . str_replace('"', '""', JText::_('COM_BANNERS_HEADING_NAME')) . '","' . str_replace('"', '""', JText::_('COM_BANNERS_HEADING_CLIENT')) . '","' . str_replace('"', '""', JText::_('JCATEGORY')) . '","' . str_replace('"', '""', JText::_('COM_BANNERS_HEADING_TYPE')) . '","' . str_replace('"', '""', JText::_('COM_BANNERS_HEADING_COUNT')) . '","' . str_replace('"', '""', JText::_('JDATE')) . '"' . "\n"; foreach ($this->getItems() as $item) { $this->content .= '"' . str_replace('"', '""', $item->banner_name) . '","' . str_replace('"', '""', $item->client_name) . '","' . str_replace('"', '""', $item->category_title) . '","' . str_replace('"', '""', ($item->track_type == 1 ? JText::_('COM_BANNERS_IMPRESSION') : JText::_('COM_BANNERS_CLICK'))) . '","' . str_replace('"', '""', $item->count) . '","' . str_replace('"', '""', $item->track_date) . '"' . "\n"; } if ($this->getState('compressed')) { $app = JFactory::getApplication('administrator'); $files = array( 'track' => array( 'name' => $this->getBasename() . '.csv', 'data' => $this->content, 'time' => time() ) ); $ziproot = $app->get('tmp_path') . '/' . uniqid('banners_tracks_') . '.zip'; // Run the packager jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $delete = JFolder::files($app->get('tmp_path') . '/', uniqid('banners_tracks_'), false, true); if (!empty($delete)) { if (!JFile::delete($delete)) { // JFile::delete throws an error $this->setError(JText::_('COM_BANNERS_ERR_ZIP_DELETE_FAILURE')); return false; } } $archive = new Archive; if (!$packager = $archive->getAdapter('zip')) { $this->setError(JText::_('COM_BANNERS_ERR_ZIP_ADAPTER_FAILURE')); return false; } elseif (!$packager->create($ziproot, $files)) { $this->setError(JText::_('COM_BANNERS_ERR_ZIP_CREATE_FAILURE')); return false; } $this->content = file_get_contents($ziproot); } } return $this->content; } } sql/index.html000064400000000037152326033420007340 0ustar00<!DOCTYPE html><title></title> sql/install.mysql.utf8.sql000064400000006472152326033420011574 0ustar00-- -- Table structure for table `#__banners` -- CREATE TABLE IF NOT EXISTS `#__banners` ( `id` int NOT NULL AUTO_INCREMENT, `cid` int NOT NULL DEFAULT 0, `type` int NOT NULL DEFAULT 0, `name` varchar(255) NOT NULL DEFAULT '', `alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '', `imptotal` int NOT NULL DEFAULT 0, `impmade` int NOT NULL DEFAULT 0, `clicks` int NOT NULL DEFAULT 0, `clickurl` varchar(200) NOT NULL DEFAULT '', `state` tinyint NOT NULL DEFAULT 0, `catid` int unsigned NOT NULL DEFAULT 0, `description` text NOT NULL, `custombannercode` varchar(2048) NOT NULL, `sticky` tinyint unsigned NOT NULL DEFAULT 0, `ordering` int NOT NULL DEFAULT 0, `metakey` text NOT NULL, `params` text NOT NULL, `own_prefix` tinyint NOT NULL DEFAULT 0, `metakey_prefix` varchar(400) NOT NULL DEFAULT '', `purchase_type` tinyint NOT NULL DEFAULT -1, `track_clicks` tinyint NOT NULL DEFAULT -1, `track_impressions` tinyint NOT NULL DEFAULT -1, `checked_out` int unsigned NOT NULL DEFAULT 0, `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `reset` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `language` char(7) NOT NULL DEFAULT '', `created_by` int unsigned NOT NULL DEFAULT 0, `created_by_alias` varchar(255) NOT NULL DEFAULT '', `modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `modified_by` int unsigned NOT NULL DEFAULT 0, `version` int unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`id`), KEY `idx_state` (`state`), KEY `idx_own_prefix` (`own_prefix`), KEY `idx_metakey_prefix` (`metakey_prefix`(100)), KEY `idx_banner_catid` (`catid`), KEY `idx_language` (`language`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `#__banner_clients` -- CREATE TABLE IF NOT EXISTS `#__banner_clients` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL DEFAULT '', `contact` varchar(255) NOT NULL DEFAULT '', `email` varchar(255) NOT NULL DEFAULT '', `extrainfo` text NOT NULL, `state` tinyint NOT NULL DEFAULT 0, `checked_out` int unsigned NOT NULL DEFAULT 0, `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `metakey` text NOT NULL, `own_prefix` tinyint NOT NULL DEFAULT 0, `metakey_prefix` varchar(400) NOT NULL DEFAULT '', `purchase_type` tinyint NOT NULL DEFAULT -1, `track_clicks` tinyint NOT NULL DEFAULT -1, `track_impressions` tinyint NOT NULL DEFAULT -1, PRIMARY KEY (`id`), KEY `idx_own_prefix` (`own_prefix`), KEY `idx_metakey_prefix` (`metakey_prefix`(100)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `#__banner_tracks` -- CREATE TABLE IF NOT EXISTS `#__banner_tracks` ( `track_date` datetime NOT NULL, `track_type` int unsigned NOT NULL, `banner_id` int unsigned NOT NULL, `count` int unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`track_date`,`track_type`,`banner_id`), KEY `idx_track_date` (`track_date`), KEY `idx_track_type` (`track_type`), KEY `idx_banner_id` (`banner_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; sql/uninstall.mysql.utf8.sql000064400000000171152326033420012125 0ustar00DROP TABLE IF EXISTS `#__banners`; DROP TABLE IF EXISTS `#__banner_clients`; DROP TABLE IF EXISTS `#__banner_tracks`; tables/banner.php000064400000017607152326033420010007 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; use Joomla\Utilities\ArrayHelper; /** * Banner table * * @since 1.5 */ class BannersTableBanner extends JTable { /** * Constructor * * @param JDatabaseDriver $db Database connector object * * @since 1.5 */ public function __construct(&$db) { parent::__construct('#__banners', 'id', $db); JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_banners.banner')); $this->created = JFactory::getDate()->toSql(); $this->setColumnAlias('published', 'state'); } /** * Increase click count * * @return void */ public function clicks() { $query = 'UPDATE #__banners' . ' SET clicks = (clicks + 1)' . ' WHERE id = ' . (int) $this->id; $this->_db->setQuery($query); $this->_db->execute(); } /** * Overloaded check function * * @return boolean * * @see JTable::check * @since 1.5 */ public function check() { // Set name $this->name = htmlspecialchars_decode($this->name, ENT_QUOTES); // Set alias if (trim($this->alias) == '') { $this->alias = $this->name; } $this->alias = JApplicationHelper::stringURLSafe($this->alias, $this->language); if (trim(str_replace('-', '', $this->alias)) == '') { $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); } // Check the publish down date is not earlier than publish up. if ($this->publish_down > $this->_db->getNullDate() && $this->publish_down < $this->publish_up) { $this->setError(JText::_('JGLOBAL_START_PUBLISH_AFTER_FINISH')); return false; } // Set ordering if ($this->state < 0) { // Set ordering to 0 if state is archived or trashed $this->ordering = 0; } elseif (empty($this->ordering)) { // Set ordering to last if ordering was 0 $this->ordering = self::getNextOrder($this->_db->quoteName('catid') . '=' . $this->_db->quote($this->catid) . ' AND state>=0'); } if (empty($this->publish_up)) { $this->publish_up = $this->getDbo()->getNullDate(); } if (empty($this->publish_down)) { $this->publish_down = $this->getDbo()->getNullDate(); } if (empty($this->modified)) { $this->modified = $this->getDbo()->getNullDate(); } return true; } /** * Overloaded bind function * * @param mixed $array An associative array or object to bind to the JTable instance. * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. * * @return boolean True on success * * @since 1.5 */ public function bind($array, $ignore = array()) { if (isset($array['params']) && is_array($array['params'])) { $registry = new Registry($array['params']); if ((int) $registry->get('width', 0) < 0) { $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_WIDTH_LABEL'))); return false; } if ((int) $registry->get('height', 0) < 0) { $this->setError(JText::sprintf('JLIB_DATABASE_ERROR_NEGATIVE_NOT_PERMITTED', JText::_('COM_BANNERS_FIELD_HEIGHT_LABEL'))); return false; } // Converts the width and height to an absolute numeric value: $width = abs((int) $registry->get('width', 0)); $height = abs((int) $registry->get('height', 0)); // Sets the width and height to an empty string if = 0 $registry->set('width', $width ?: ''); $registry->set('height', $height ?: ''); $array['params'] = (string) $registry; } if (isset($array['imptotal'])) { $array['imptotal'] = abs((int) $array['imptotal']); } return parent::bind($array, $ignore); } /** * Method to store a row * * @param boolean $updateNulls True to update fields even if they are null. * * @return boolean True on success, false on failure. */ public function store($updateNulls = false) { $db = $this->getDbo(); if (empty($this->id)) { $purchaseType = $this->purchase_type; if ($purchaseType < 0 && $this->cid) { /** @var BannersTableClient $client */ $client = JTable::getInstance('Client', 'BannersTable', array('dbo' => $db)); $client->load($this->cid); $purchaseType = $client->purchase_type; } if ($purchaseType < 0) { $purchaseType = JComponentHelper::getParams('com_banners')->get('purchase_type'); } switch ($purchaseType) { case 1: $this->reset = $this->_db->getNullDate(); break; case 2: $date = JFactory::getDate('+1 year ' . date('Y-m-d')); $this->reset = $date->toSql(); break; case 3: $date = JFactory::getDate('+1 month ' . date('Y-m-d')); $this->reset = $date->toSql(); break; case 4: $date = JFactory::getDate('+7 day ' . date('Y-m-d')); $this->reset = $date->toSql(); break; case 5: $date = JFactory::getDate('+1 day ' . date('Y-m-d')); $this->reset = $date->toSql(); break; } // Store the row parent::store($updateNulls); } else { // Get the old row /** @var BannersTableBanner $oldrow */ $oldrow = JTable::getInstance('Banner', 'BannersTable', array('dbo' => $db)); if (!$oldrow->load($this->id) && $oldrow->getError()) { $this->setError($oldrow->getError()); } // Verify that the alias is unique /** @var BannersTableBanner $table */ $table = JTable::getInstance('Banner', 'BannersTable', array('dbo' => $db)); if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { $this->setError(JText::_('COM_BANNERS_ERROR_UNIQUE_ALIAS')); return false; } // Store the new row parent::store($updateNulls); // Need to reorder ? if ($oldrow->state >= 0 && ($this->state < 0 || $oldrow->catid != $this->catid)) { // Reorder the oldrow $this->reorder($this->_db->quoteName('catid') . '=' . $this->_db->quote($oldrow->catid) . ' AND state>=0'); } } return count($this->getErrors()) == 0; } /** * Method to set the sticky 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 $pks An optional array of primary key values to update. If not set the instance property value is used. * @param integer $state The sticky state. eg. [0 = unsticked, 1 = sticked] * @param integer $userId The user id of the user performing the operation. * * @return boolean True on success. * * @since 1.6 */ public function stick($pks = null, $state = 1, $userId = 0) { $k = $this->_tbl_key; // Sanitize input. $pks = ArrayHelper::toInteger($pks); $userId = (int) $userId; $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; } } // Get an instance of the table /** @var BannersTableBanner $table */ $table = JTable::getInstance('Banner', 'BannersTable'); // For all keys foreach ($pks as $pk) { // Load the banner if (!$table->load($pk)) { $this->setError($table->getError()); } // Verify checkout if ($table->checked_out == 0 || $table->checked_out == $userId) { // Change the state $table->sticky = $state; $table->checked_out = 0; $table->checked_out_time = $this->_db->getNullDate(); // Check the row $table->check(); // Store the row if (!$table->store()) { $this->setError($table->getError()); } } } return count($this->getErrors()) == 0; } } tables/client.php000064400000006145152326033420010013 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Client table * * @since 1.6 */ class BannersTableClient extends JTable { /** * Constructor * * @param JDatabaseDriver $db Database connector object * * @since 1.5 */ public function __construct(&$db) { $this->checked_out_time = $db->getNullDate(); parent::__construct('#__banner_clients', 'id', $db); $this->setColumnAlias('published', 'state'); JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_banners.client')); } /** * 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 $pks An optional array of primary key values to update. If not set the instance property value is used. * @param integer $state The publishing state. eg. [0 = unpublished, 1 = published, 2=archived, -2=trashed] * @param integer $userId The user id of the user performing the operation. * * @return boolean True on success. * * @since 1.0.4 */ public function publish($pks = null, $state = 1, $userId = 0) { $k = $this->_tbl_key; // Sanitize input. $pks = ArrayHelper::toInteger($pks); $userId = (int) $userId; $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 . '=' . implode(' OR ' . $k . '=', $pks); // Determine if there is checkin support for the table. if (!property_exists($this, 'checked_out') || !property_exists($this, 'checked_out_time')) { $checkin = ''; } else { $checkin = ' AND (checked_out = 0 OR checked_out = ' . (int) $userId . ')'; } // 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 . ')' . $checkin ); try { $this->_db->execute(); } catch (RuntimeException $e) { $this->setError($e->getMessage()); return false; } // If checkin is supported and all rows were adjusted, check them in. if ($checkin && (count($pks) == $this->_db->getAffectedRows())) { // Checkin the rows. foreach ($pks as $pk) { $this->checkin($pk); } } // 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; } } tables/index.html000064400000000037152326033420010013 0ustar00<!DOCTYPE html><title></title> views/banner/tmpl/edit.php000064400000006066152326033420011570 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('jquery.framework'); JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', '#jform_catid', null, array('disable_search_threshold' => 0 )); JHtml::_('formbehavior.chosen', 'select'); JFactory::getDocument()->addScriptDeclaration(' Joomla.submitbutton = function(task) { if (task == "banner.cancel" || document.formvalidator.isValid(document.getElementById("banner-form"))) { Joomla.submitform(task, document.getElementById("banner-form")); } }; jQuery(document).ready(function ($){ $("#jform_type").on("change", function (a, params) { var v = typeof(params) !== "object" ? $("#jform_type").val() : params.selected; var img_url = $("#image, #url"); var custom = $("#custom"); switch (v) { case "0": // Image img_url.show(); custom.hide(); break; case "1": // Custom img_url.hide(); custom.show(); break; } }).trigger("change"); }); '); ?> <form action="<?php echo JRoute::_('index.php?option=com_banners&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="banner-form" class="form-validate"> <?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?> <div class="form-horizontal"> <?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', JText::_('COM_BANNERS_BANNER_DETAILS')); ?> <div class="row-fluid"> <div class="span9"> <?php echo $this->form->renderField('type'); ?> <div id="image"> <?php echo $this->form->renderFieldset('image'); ?> </div> <div id="custom"> <?php echo $this->form->renderField('custombannercode'); ?> </div> <?php echo $this->form->renderField('clickurl'); echo $this->form->renderField('description'); ?> </div> <div class="span3"> <?php echo JLayoutHelper::render('joomla.edit.global', $this); ?> </div> </div> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'otherparams', JText::_('COM_BANNERS_GROUP_LABEL_BANNER_DETAILS')); ?> <?php echo $this->form->renderFieldset('otherparams'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', JText::_('JGLOBAL_FIELDSET_PUBLISHING')); ?> <div class="row-fluid form-horizontal-desktop"> <div class="span6"> <?php echo JLayoutHelper::render('joomla.edit.publishingdata', $this); ?> </div> <div class="span6"> <?php echo $this->form->renderFieldset('metadata'); ?> </div> </div> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTabSet'); ?> </div> <input type="hidden" name="task" value="" /> <?php echo JHtml::_('form.token'); ?> </form> views/banner/tmpl/index.html000064400000000037152326033420012117 0ustar00<!DOCTYPE html><title></title> views/banner/index.html000064400000000037152326033420011143 0ustar00<!DOCTYPE html><title></title> views/banner/view.html.php000064400000005610152326033420011576 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * View to edit a banner. * * @since 1.5 */ class BannersViewBanner extends JViewLegacy { /** * The JForm object * * @var JForm */ protected $form; /** * The active item * * @var object */ protected $item; /** * The model state * * @var object */ protected $state; /** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { // Initialize variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors), 500); } $this->addToolbar(); return parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->id; $isNew = ($this->item->id == 0); $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); // Since we don't track these assets at the item level, use the category id. $canDo = JHelperContent::getActions('com_banners', 'category', $this->item->catid); JToolbarHelper::title($isNew ? JText::_('COM_BANNERS_MANAGER_BANNER_NEW') : JText::_('COM_BANNERS_MANAGER_BANNER_EDIT'), 'bookmark banners'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0)) { JToolbarHelper::apply('banner.apply'); JToolbarHelper::save('banner.save'); if ($canDo->get('core.create')) { JToolbarHelper::save2new('banner.save2new'); } } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolbarHelper::save2copy('banner.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('banner.cancel'); } else { if (JComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) { JToolbarHelper::versions('com_banners.banner', $this->item->id); } JToolbarHelper::cancel('banner.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS_EDIT'); } } views/banners/tmpl/default.php000064400000017606152326033420012454 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('bootstrap.tooltip'); JHtml::_('behavior.multiselect'); JHtml::_('formbehavior.chosen', 'select'); $user = JFactory::getUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'a.ordering'; if ($saveOrder) { $saveOrderingUrl = 'index.php?option=com_banners&task=banners.saveOrderAjax&tmpl=component'; JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); } ?> <form action="<?php echo JRoute::_('index.php?option=com_banners&view=banners'); ?>" method="post" name="adminForm" id="adminForm"> <div id="j-sidebar-container" class="span2"> <?php echo $this->sidebar; ?> </div> <div id="j-main-container" class="span10"> <?php // Search tools bar echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> <?php if (empty($this->items)) : ?> <div class="alert alert-no-items"> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div> <?php else : ?> <table class="table table-striped" id="articleList"> <thead> <tr> <th width="1%" class="nowrap center hidden-phone"> <?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> </th> <th width="1%" class="center"> <?php echo JHtml::_('grid.checkall'); ?> </th> <th width="1%" class="nowrap center"> <?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?> </th> <th> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_NAME', 'a.name', $listDirn, $listOrder); ?> </th> <th width="1%" class="nowrap center hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_STICKY', 'a.sticky', $listDirn, $listOrder); ?> </th> <th width="10%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_CLIENT', 'client_name', $listDirn, $listOrder); ?> </th> <th width="10%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_IMPRESSIONS', 'impmade', $listDirn, $listOrder); ?> </th> <th width="10%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_CLICKS', 'clicks', $listDirn, $listOrder); ?> </th> <th width="10%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?> </th> <th width="1%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?> </th> </tr> </thead> <tfoot> <tr> <td colspan="13"> <?php echo $this->pagination->getListFooter(); ?> </td> </tr> </tfoot> <tbody> <?php foreach ($this->items as $i => $item) : $ordering = ($listOrder == 'ordering'); $item->cat_link = JRoute::_('index.php?option=com_categories&extension=com_banners&task=edit&type=other&cid[]=' . $item->catid); $canCreate = $user->authorise('core.create', 'com_banners.category.' . $item->catid); $canEdit = $user->authorise('core.edit', 'com_banners.category.' . $item->catid); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; $canChange = $user->authorise('core.edit.state', 'com_banners.category.' . $item->catid) && $canCheckin; ?> <tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->catid; ?>"> <td class="order nowrap center hidden-phone"> <?php $iconClass = ''; if (!$canChange) { $iconClass = ' inactive'; } elseif (!$saveOrder) { $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::_('tooltipText', 'JORDERINGDISABLED'); } ?> <span class="sortable-handler <?php echo $iconClass ?>"> <span class="icon-menu" aria-hidden="true"></span> </span> <?php if ($canChange && $saveOrder) : ?> <input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering; ?>" class="width-20 text-area-order" /> <?php endif; ?> </td> <td class="center"> <?php echo JHtml::_('grid.id', $i, $item->id); ?> </td> <td class="center"> <div class="btn-group"> <?php echo JHtml::_('jgrid.published', $item->state, $i, 'banners.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?> <?php // Create dropdown items and render the dropdown list. if ($canChange) { JHtml::_('actionsdropdown.' . ((int) $item->state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'banners'); JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'banners'); echo JHtml::_('actionsdropdown.render', $this->escape($item->name)); } ?> </div> </td> <td class="has-context"> <div class="pull-left break-word"> <?php if ($item->checked_out) : ?> <?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'banners.', $canCheckin); ?> <?php endif; ?> <?php if ($canEdit) : ?> <a href="<?php echo JRoute::_('index.php?option=com_banners&task=banner.edit&id=' . (int) $item->id); ?>"> <?php echo $this->escape($item->name); ?></a> <?php else : ?> <?php echo $this->escape($item->name); ?> <?php endif; ?> <span class="small break-word"> <?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?> </span> <div class="small"> <?php echo JText::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?> </div> </div> </td> <td class="center hidden-phone"> <?php echo JHtml::_('banner.pinned', $item->sticky, $i, $canChange); ?> </td> <td class="small hidden-phone"> <?php echo $item->client_name; ?> </td> <td class="small hidden-phone"> <?php echo JText::sprintf('COM_BANNERS_IMPRESSIONS', $item->impmade, $item->imptotal ?: JText::_('COM_BANNERS_UNLIMITED')); ?> </td> <td class="small hidden-phone"> <?php echo $item->clicks; ?> - <?php echo sprintf('%.2f%%', $item->impmade ? 100 * $item->clicks / $item->impmade : 0); ?> </td> <td class="small nowrap hidden-phone"> <?php echo JLayoutHelper::render('joomla.content.language', $item); ?> </td> <td class="hidden-phone"> <?php echo $item->id; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php // Load the batch processing form. ?> <?php if ($user->authorise('core.create', 'com_banners') && $user->authorise('core.edit', 'com_banners') && $user->authorise('core.edit.state', 'com_banners')) : ?> <?php echo JHtml::_( 'bootstrap.renderModal', 'collapseModal', array( 'title' => JText::_('COM_BANNERS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer'), ), $this->loadTemplate('batch_body') ); ?> <?php endif; ?> <?php endif; ?> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> <?php echo JHtml::_('form.token'); ?> </div> </form> views/banners/tmpl/default_batch_body.php000064400000001551152326033420014622 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; $published = $this->state->get('filter.published'); ?> <div class="container-fluid"> <div class="row-fluid"> <div class="control-group span6"> <div class="controls"> <?php echo JHtml::_('batch.language'); ?> </div> </div> <div class="control-group span6"> <div class="controls"> <?php echo JHtml::_('banner.clients'); ?> </div> </div> </div> <div class="row-fluid"> <?php if ($published >= 0) : ?> <div class="control-group span6"> <div class="controls"> <?php echo JHtml::_('batch.item', 'com_banners'); ?> </div> </div> <?php endif; ?> </div> </div> views/banners/tmpl/default_batch_footer.php000064400000001302152326033420015155 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; ?> <button type="button" class="btn" onclick="document.getElementById('batch-category-id').value='';document.getElementById('batch-client-id').value='';document.getElementById('batch-language-id').value=''" data-dismiss="modal"> <?php echo JText::_('JCANCEL'); ?> </button> <button type="submit" class="btn btn-success" onclick="Joomla.submitbutton('banner.batch');return false;"> <?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?> </button> views/banners/tmpl/index.html000064400000000037152326033420012302 0ustar00<!DOCTYPE html><title></title> views/banners/index.html000064400000000037152326033420011326 0ustar00<!DOCTYPE html><title></title> views/banners/view.html.php000064400000011141152326033420011755 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * View class for a list of banners. * * @since 1.6 */ class BannersViewBanners extends JViewLegacy { /** * Category data * * @var array */ protected $categories; /** * An array of items * * @var array */ protected $items; /** * The pagination object * * @var JPagination */ protected $pagination; /** * The model state * * @var object */ protected $state; /** * Method to display the view. * * @param string $tpl A template file to load. [optional] * * @return mixed A string if successful, otherwise a JError object. * * @since 1.6 */ public function display($tpl = null) { $this->categories = $this->get('CategoryOrders'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors), 500); } BannersHelper::addSubmenu('banners'); $this->addToolbar(); // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); $this->sidebar = JHtmlSidebar::render(); return parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); $canDo = JHelperContent::getActions('com_banners', 'category', $this->state->get('filter.category_id')); $user = JFactory::getUser(); JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_BANNERS'), 'bookmark banners'); if (count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0) { JToolbarHelper::addNew('banner.add'); } if ($canDo->get('core.edit')) { JToolbarHelper::editList('banner.edit'); } if ($canDo->get('core.edit.state')) { if ($this->state->get('filter.published') != 2) { JToolbarHelper::publish('banners.publish', 'JTOOLBAR_PUBLISH', true); JToolbarHelper::unpublish('banners.unpublish', 'JTOOLBAR_UNPUBLISH', true); } if ($this->state->get('filter.published') != -1) { if ($this->state->get('filter.published') != 2) { JToolbarHelper::archiveList('banners.archive'); } elseif ($this->state->get('filter.published') == 2) { JToolbarHelper::unarchiveList('banners.publish'); } } } if ($canDo->get('core.edit.state')) { JToolbarHelper::checkin('banners.checkin'); } // Add a batch button if ($user->authorise('core.create', 'com_banners') && $user->authorise('core.edit', 'com_banners') && $user->authorise('core.edit.state', 'com_banners')) { $title = JText::_('JTOOLBAR_BATCH'); // Instantiate a new JLayoutFile instance and render the batch button $layout = new JLayoutFile('joomla.toolbar.batch'); $dhtml = $layout->render(array('title' => $title)); JToolbar::getInstance('toolbar')->appendButton('Custom', $dhtml, 'batch'); } if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) { JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'banners.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($canDo->get('core.edit.state')) { JToolbarHelper::trash('banners.trash'); } if ($user->authorise('core.admin', 'com_banners') || $user->authorise('core.options', 'com_banners')) { JToolbarHelper::preferences('com_banners'); } JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS'); } /** * Returns an array of fields the table can be sorted by * * @return array Array containing the field name to sort by as the key and display text as value * * @since 3.0 */ protected function getSortFields() { return array( 'ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.state' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_BANNERS_HEADING_NAME'), 'a.sticky' => JText::_('COM_BANNERS_HEADING_STICKY'), 'client_name' => JText::_('COM_BANNERS_HEADING_CLIENT'), 'impmade' => JText::_('COM_BANNERS_HEADING_IMPRESSIONS'), 'clicks' => JText::_('COM_BANNERS_HEADING_CLICKS'), 'a.language' => JText::_('JGRID_HEADING_LANGUAGE'), 'a.id' => JText::_('JGRID_HEADING_ID'), ); } } views/client/tmpl/edit.php000064400000004121152326033420011567 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); JFactory::getDocument()->addScriptDeclaration(' Joomla.submitbutton = function(task) { if (task == "client.cancel" || document.formvalidator.isValid(document.getElementById("client-form"))) { Joomla.submitform(task, document.getElementById("client-form")); } }; '); ?> <form action="<?php echo JRoute::_('index.php?option=com_banners&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="client-form" class="form-validate"> <?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?> <div class="form-horizontal"> <?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'general')); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'general', empty($this->item->id) ? JText::_('COM_BANNERS_NEW_CLIENT') : JText::_('COM_BANNERS_EDIT_CLIENT')); ?> <div class="row-fluid"> <div class="span9"> <?php echo $this->form->renderField('contact'); echo $this->form->renderField('email'); echo $this->form->renderField('purchase_type'); echo $this->form->renderField('track_impressions'); echo $this->form->renderField('track_clicks'); echo $this->form->renderFieldset('extra'); ?> </div> <div class="span3"> <?php echo JLayoutHelper::render('joomla.edit.global', $this); ?> </div> </div> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.addTab', 'myTab', 'metadata', JText::_('JGLOBAL_FIELDSET_METADATA_OPTIONS')); ?> <?php echo $this->form->renderFieldset('metadata'); ?> <?php echo JHtml::_('bootstrap.endTab'); ?> <?php echo JHtml::_('bootstrap.endTabSet'); ?> </div> <input type="hidden" name="task" value="" /> <?php echo JHtml::_('form.token'); ?> </form> views/client/tmpl/index.html000064400000000037152326033420012130 0ustar00<!DOCTYPE html><title></title> views/client/index.html000064400000000037152326033420011154 0ustar00<!DOCTYPE html><title></title> views/client/view.html.php000064400000005534152326033420011614 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * View to edit a client. * * @since 1.5 */ class BannersViewClient extends JViewLegacy { /** * The JForm object * * @var JForm */ protected $form; /** * The active item * * @var object */ protected $item; /** * The model state * * @var object */ protected $state; /** * Object containing permissions for the item * * @var JObject */ protected $canDo; /** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->canDo = JHelperContent::getActions('com_banners'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors), 500); } $this->addToolbar(); return parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = ($this->item->id == 0); $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->id); $canDo = $this->canDo; JToolbarHelper::title( $isNew ? JText::_('COM_BANNERS_MANAGER_CLIENT_NEW') : JText::_('COM_BANNERS_MANAGER_CLIENT_EDIT'), 'bookmark banners-clients' ); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) { JToolbarHelper::apply('client.apply'); JToolbarHelper::save('client.save'); } if (!$checkedOut && $canDo->get('core.create')) { JToolbarHelper::save2new('client.save2new'); } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolbarHelper::save2copy('client.save2copy'); } if (empty($this->item->id)) { JToolbarHelper::cancel('client.cancel'); } else { if (JComponentHelper::isEnabled('com_contenthistory') && $this->state->params->get('save_history', 0) && $canDo->get('core.edit')) { JToolbarHelper::versions('com_banners.client', $this->item->id); } JToolbarHelper::cancel('client.cancel', 'JTOOLBAR_CLOSE'); } JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS_EDIT'); } } views/clients/tmpl/default.php000064400000017223152326033420012460 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('bootstrap.tooltip'); JHtml::_('behavior.multiselect'); JHtml::_('formbehavior.chosen', 'select'); $purchaseTypes = array( '1' => 'UNLIMITED', '2' => 'YEARLY', '3' => 'MONTHLY', '4' => 'WEEKLY', '5' => 'DAILY', ); $user = JFactory::getUser(); $userId = $user->get('id'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $params = isset($this->state->params) ? $this->state->params : new JObject; ?> <form action="<?php echo JRoute::_('index.php?option=com_banners&view=clients'); ?>" method="post" name="adminForm" id="adminForm"> <div id="j-sidebar-container" class="span2"> <?php echo $this->sidebar; ?> </div> <div id="j-main-container" class="span10"> <?php // Search tools bar echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> <?php if (empty($this->items)) : ?> <div class="alert alert-no-items"> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div> <?php else : ?> <table class="table table-striped"> <thead> <tr> <th width="1%" class="center"> <?php echo JHtml::_('grid.checkall'); ?> </th> <th width="5%" class="nowrap center"> <?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?> </th> <th> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_CLIENT', 'a.name', $listDirn, $listOrder); ?> </th> <th width="20%" class="hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_CONTACT', 'a.contact', $listDirn, $listOrder); ?> </th> <th width="1%" class="nowrap center hidden-phone hidden-tablet"> <span class="icon-publish hasTooltip" aria-hidden="true" title="<?php echo JText::_('COM_BANNERS_COUNT_PUBLISHED_ITEMS'); ?>"><span class="element-invisible"><?php echo JText::_('COM_BANNERS_COUNT_PUBLISHED_ITEMS'); ?></span></span> </th> <th width="1%" class="nowrap center hidden-phone hidden-tablet"> <span class="icon-unpublish hasTooltip" aria-hidden="true" title="<?php echo JText::_('COM_BANNERS_COUNT_UNPUBLISHED_ITEMS'); ?>"><span class="element-invisible"><?php echo JText::_('COM_BANNERS_COUNT_UNPUBLISHED_ITEMS'); ?></span></span> </th> <th width="1%" class="nowrap center hidden-phone hidden-tablet"> <span class="icon-archive hasTooltip" aria-hidden="true" title="<?php echo JText::_('COM_BANNERS_COUNT_ARCHIVED_ITEMS'); ?>"><span class="element-invisible"><?php echo JText::_('COM_BANNERS_COUNT_ARCHIVED_ITEMS'); ?></span></span> </th> <th width="1%" class="nowrap center hidden-phone hidden-tablet"> <span class="icon-trash hasTooltip" aria-hidden="true" title="<?php echo JText::_('COM_BANNERS_COUNT_TRASHED_ITEMS'); ?>"><span class="element-invisible"><?php echo JText::_('COM_BANNERS_COUNT_TRASHED_ITEMS'); ?></span></span> </th> <th width="10%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_PURCHASETYPE', 'a.purchase_type', $listDirn, $listOrder); ?> </th> <th width="1%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?> </th> </tr> </thead> <tfoot> <tr> <td colspan="11"> <?php echo $this->pagination->getListFooter(); ?> </td> </tr> </tfoot> <tbody> <?php foreach ($this->items as $i => $item) : $canCreate = $user->authorise('core.create', 'com_banners'); $canEdit = $user->authorise('core.edit', 'com_banners'); $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0; $canChange = $user->authorise('core.edit.state', 'com_banners') && $canCheckin; ?> <tr class="row<?php echo $i % 2; ?>"> <td class="center"> <?php echo JHtml::_('grid.id', $i, $item->id); ?> </td> <td class="center"> <div class="btn-group"> <?php echo JHtml::_('jgrid.published', $item->state, $i, 'clients.', $canChange); ?> <?php // Create dropdown items and render the dropdown list. if ($canChange) { JHtml::_('actionsdropdown.' . ((int) $item->state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'clients'); JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'clients'); echo JHtml::_('actionsdropdown.render', $this->escape($item->name)); } ?> </div> </td> <td class="nowrap has-context"> <div class="pull-left"> <?php if ($item->checked_out) : ?> <?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'clients.', $canCheckin); ?> <?php endif; ?> <?php if ($canEdit) : ?> <a href="<?php echo JRoute::_('index.php?option=com_banners&task=client.edit&id=' . (int) $item->id); ?>"> <?php echo $this->escape($item->name); ?></a> <?php else : ?> <?php echo $this->escape($item->name); ?> <?php endif; ?> </div> </td> <td class="small hidden-phone"> <?php echo $item->contact; ?> </td> <td class="center btns hidden-phone hidden-tablet"> <a class="badge <?php if ($item->count_published > 0) echo 'badge-success'; ?>" href="<?php echo JRoute::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=1'); ?>"> <?php echo $item->count_published; ?></a> </td> <td class="center btns hidden-phone hidden-tablet"> <a class="badge <?php if ($item->count_unpublished > 0) echo 'badge-important'; ?>" href="<?php echo JRoute::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=0'); ?>"> <?php echo $item->count_unpublished; ?></a> </td> <td class="center btns hidden-phone hidden-tablet"> <a class="badge <?php if ($item->count_archived > 0) echo 'badge-info'; ?>" href="<?php echo JRoute::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=2'); ?>"> <?php echo $item->count_archived; ?></a> </td> <td class="center btns hidden-phone hidden-tablet"> <a class="badge <?php if ($item->count_trashed > 0) echo 'badge-inverse'; ?>" href="<?php echo JRoute::_('index.php?option=com_banners&view=banners&filter[client_id]=' . (int) $item->id . '&filter[published]=-2'); ?>"> <?php echo $item->count_trashed; ?></a> </td> <td class="small hidden-phone"> <?php if ($item->purchase_type < 0) : ?> <?php echo JText::sprintf('COM_BANNERS_DEFAULT', JText::_('COM_BANNERS_FIELD_VALUE_' . $purchaseTypes[$params->get('purchase_type')])); ?> <?php else : ?> <?php echo JText::_('COM_BANNERS_FIELD_VALUE_' . $purchaseTypes[$item->purchase_type]); ?> <?php endif; ?> </td> <td class="hidden-phone"> <?php echo $item->id; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php endif; ?> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> <?php echo JHtml::_('form.token'); ?> </div> </form> views/clients/tmpl/index.html000064400000000037152326033420012313 0ustar00<!DOCTYPE html><title></title> views/clients/index.html000064400000000037152326033420011337 0ustar00<!DOCTYPE html><title></title> views/clients/view.html.php000064400000006337152326033420012001 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * View class for a list of clients. * * @since 1.6 */ class BannersViewClients extends JViewLegacy { /** * An array of items * * @var array */ protected $items; /** * The pagination object * * @var JPagination */ protected $pagination; /** * The model state * * @var object */ protected $state; /** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors), 500); } BannersHelper::addSubmenu('clients'); $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); return parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { $canDo = JHelperContent::getActions('com_banners'); JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_CLIENTS'), 'bookmark banners-clients'); if ($canDo->get('core.create')) { JToolbarHelper::addNew('client.add'); } if ($canDo->get('core.edit')) { JToolbarHelper::editList('client.edit'); } if ($canDo->get('core.edit.state')) { JToolbarHelper::publish('clients.publish', 'JTOOLBAR_PUBLISH', true); JToolbarHelper::unpublish('clients.unpublish', 'JTOOLBAR_UNPUBLISH', true); JToolbarHelper::archiveList('clients.archive'); JToolbarHelper::checkin('clients.checkin'); } if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'clients.delete', 'JTOOLBAR_EMPTY_TRASH'); } elseif ($canDo->get('core.edit.state')) { JToolbarHelper::trash('clients.trash'); } if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_banners'); } JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS'); } /** * Returns an array of fields the table can be sorted by * * @return array Array containing the field name to sort by as the key and display text as value * * @since 3.0 */ protected function getSortFields() { return array( 'a.status' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_BANNERS_HEADING_CLIENT'), 'contact' => JText::_('COM_BANNERS_HEADING_CONTACT'), 'client_name' => JText::_('COM_BANNERS_HEADING_CLIENT'), 'nbanners' => JText::_('COM_BANNERS_HEADING_ACTIVE'), 'a.id' => JText::_('JGRID_HEADING_ID') ); } } views/download/tmpl/default.php000064400000002126152326033420012622 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); ?> <div class="container-popup"> <form class="form-horizontal form-validate" id="download-form" name="adminForm" action="<?php echo JRoute::_('index.php?option=com_banners&task=tracks.display&format=raw&' . JSession::getFormToken() . '=1'); ?>" method="post"> <?php foreach ($this->form->getFieldset() as $field) : ?> <?php echo $this->form->renderField($field->fieldname); ?> <?php endforeach; ?> <button class="hidden" id="closeBtn" type="button" onclick="window.parent.jQuery('#modal-download').modal('hide');"> </button> <button class="hidden" id="exportBtn" type="button" onclick="this.form.submit();window.top.setTimeout('window.parent.jQuery(\'#downloadModal\').modal(\'hide\')', 700);"> </button> </form> </div> views/download/tmpl/index.html000064400000000037152326033420012461 0ustar00<!DOCTYPE html><title></title> views/download/index.html000064400000000037152326033420011505 0ustar00<!DOCTYPE html><title></title> views/download/view.html.php000064400000001637152326033420012145 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * View class for download a list of tracks. * * @since 1.6 */ class BannersViewDownload extends JViewLegacy { /** * The JForm object * * @var JForm */ protected $form; /** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { $this->form = $this->get('Form'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors), 500); } return parent::display($tpl); } } views/tracks/tmpl/default.php000064400000007603152326033420012307 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('formbehavior.chosen', 'select'); JHtml::_('bootstrap.tooltip'); $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_banners&view=tracks'); ?>" 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; ?> <?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> <?php if (empty($this->items)) : ?> <div class="alert alert-no-items"> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div> <?php else : ?> <table class="table table-striped"> <thead> <tr> <th class="title"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_NAME', 'b.name', $listDirn, $listOrder); ?> </th> <th width="20%" class="nowrap"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_CLIENT', 'cl.name', $listDirn, $listOrder); ?> </th> <th width="10%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_TYPE', 'a.track_type', $listDirn, $listOrder); ?> </th> <th width="10%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'COM_BANNERS_HEADING_COUNT', 'a.count', $listDirn, $listOrder); ?> </th> <th width="10%" class="nowrap hidden-phone"> <?php echo JHtml::_('searchtools.sort', 'JDATE', 'a.track_date', $listDirn, $listOrder); ?> </th> </tr> </thead> <tfoot> <tr> <td colspan="5"> <?php echo $this->pagination->getListFooter(); ?> </td> </tr> </tfoot> <tbody> <?php foreach ($this->items as $i => $item) : ?> <tr class="row<?php echo $i % 2; ?>"> <td> <?php echo $item->banner_name; ?> <div class="small"> <?php echo JText::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?> </div> </td> <td> <?php echo $item->client_name; ?> </td> <td class="small hidden-phone"> <?php echo $item->track_type == 1 ? JText::_('COM_BANNERS_IMPRESSION') : JText::_('COM_BANNERS_CLICK'); ?> </td> <td class="hidden-phone"> <?php echo $item->count; ?> </td> <td class="hidden-phone"> <?php echo JHtml::_('date', $item->track_date, JText::_('DATE_FORMAT_LC5')); ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php endif; ?> <?php // Load the export form ?> <?php echo JHtml::_( 'bootstrap.renderModal', 'downloadModal', array( 'title' => JText::_('COM_BANNERS_TRACKS_DOWNLOAD'), 'url' => JRoute::_('index.php?option=com_banners&view=download&tmpl=component'), 'height' => '370px', 'width' => '300px', 'modalWidth' => '40', 'footer' => '<button type="button" class="btn" data-dismiss="modal"' . ' onclick="jQuery(\'#downloadModal iframe\').contents().find(\'#closeBtn\').click();">' . JText::_('COM_BANNERS_CANCEL') . '</button>' . '<button type="button" class="btn btn-success"' . ' onclick="jQuery(\'#downloadModal iframe\').contents().find(\'#exportBtn\').click();">' . JText::_('COM_BANNERS_TRACKS_EXPORT') . '</button>', ) ); ?> <input type="hidden" name="task" value="" /> <input type="hidden" name="boxchecked" value="0" /> <?php echo JHtml::_('form.token'); ?> </div> </form> views/tracks/tmpl/index.html000064400000000037152326033420012141 0ustar00<!DOCTYPE html><title></title> views/tracks/index.html000064400000000037152326033420011165 0ustar00<!DOCTYPE html><title></title> views/tracks/view.html.php000064400000006224152326033420011622 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * View class for a list of tracks. * * @since 1.6 */ class BannersViewTracks extends JViewLegacy { /** * An array of items * * @var array */ protected $items; /** * The pagination object * * @var JPagination */ protected $pagination; /** * The model state * * @var object */ protected $state; /** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors), 500); } BannersHelper::addSubmenu('tracks'); $this->addToolbar(); $this->sidebar = JHtmlSidebar::render(); return parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { $canDo = JHelperContent::getActions('com_banners', 'category', $this->state->get('filter.category_id')); JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_TRACKS'), 'bookmark banners-tracks'); $bar = JToolbar::getInstance('toolbar'); // Instantiate a new JLayoutFile instance and render the export button $layout = new JLayoutFile('joomla.toolbar.modal'); $dhtml = $layout->render( array( 'selector' => 'downloadModal', 'icon' => 'download', 'text' => JText::_('JTOOLBAR_EXPORT'), ) ); $bar->appendButton('Custom', $dhtml, 'download'); if ($canDo->get('core.delete')) { $bar->appendButton('Confirm', 'COM_BANNERS_DELETE_MSG', 'delete', 'COM_BANNERS_TRACKS_DELETE', 'tracks.delete', false); JToolbarHelper::divider(); } if ($canDo->get('core.admin') || $canDo->get('core.options')) { JToolbarHelper::preferences('com_banners'); JToolbarHelper::divider(); } JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_TRACKS'); JHtmlSidebar::setAction('index.php?option=com_banners&view=tracks'); } /** * Returns an array of fields the table can be sorted by * * @return array Array containing the field name to sort by as the key and display text as value * * @since 3.0 */ protected function getSortFields() { return array( 'b.name' => JText::_('COM_BANNERS_HEADING_NAME'), 'cl.name' => JText::_('COM_BANNERS_HEADING_CLIENT'), 'track_type' => JText::_('COM_BANNERS_HEADING_TYPE'), 'count' => JText::_('COM_BANNERS_HEADING_COUNT'), 'track_date' => JText::_('JDATE') ); } } views/tracks/view.raw.php000064400000002237152326033420011447 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * View class for a list of tracks. * * @since 1.6 */ class BannersViewTracks extends JViewLegacy { /** * Display the view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { $basename = $this->get('BaseName'); $filetype = $this->get('FileType'); $mimetype = $this->get('MimeType'); $content = $this->get('Content'); // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors), 500); } $document = JFactory::getDocument(); $document->setMimeEncoding($mimetype); JFactory::getApplication() ->setHeader( 'Content-disposition', 'attachment; filename="' . $basename . '.' . $filetype . '"; creation-date="' . JFactory::getDate()->toRFC822() . '"', true ); echo $content; } } views/index.html000064400000000037152326033420007676 0ustar00<!DOCTYPE html><title></title> access.xml000064400000002575152326033420006540 0ustar00<?xml version="1.0" encoding="utf-8"?> <access component="com_banners"> <section name="component"> <action name="core.admin" description="JACTION_ADMIN_COMPONENT_DESC" title="JACTION_ADMIN" /> <action name="core.options" description="JACTION_OPTIONS_COMPONENT_DESC" title="JACTION_OPTIONS" /> <action name="core.manage" description="JACTION_MANAGE_COMPONENT_DESC" title="JACTION_MANAGE" /> <action name="core.create" description="JACTION_CREATE_COMPONENT_DESC" title="JACTION_CREATE" /> <action name="core.delete" description="JACTION_DELETE_COMPONENT_DESC" title="JACTION_DELETE" /> <action name="core.edit" description="JACTION_EDIT_COMPONENT_DESC" title="JACTION_EDIT" /> <action name="core.edit.state" description="JACTION_EDITSTATE_COMPONENT_DESC" title="JACTION_EDITSTATE" /> </section> <section name="category"> <action name="core.create" description="COM_CATEGORIES_ACCESS_CREATE_DESC" title="JACTION_CREATE" /> <action name="core.delete" description="COM_CATEGORIES_ACCESS_DELETE_DESC" title="JACTION_DELETE" /> <action name="core.edit" description="COM_CATEGORIES_ACCESS_EDIT_DESC" title="JACTION_EDIT" /> <action name="core.edit.state" description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" title="JACTION_EDITSTATE" /> </section> </access> banners.php000064400000001153152326033420006705 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.tabstate'); if (!JFactory::getUser()->authorise('core.manage', 'com_banners')) { throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); } // Execute the task. $controller = JControllerLegacy::getInstance('Banners'); $controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect(); banners.xml000064400000004563152326033420006726 0ustar00<?xml version="1.0" encoding="utf-8"?> <extension type="component" version="3.1" method="upgrade"> <name>com_banners</name> <author>Joomla! Project</author> <creationDate>April 2006</creationDate> <copyright>(C) 2006 Open Source Matters, Inc.</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_BANNERS_XML_DESCRIPTION</description> <install> <!-- Runs on install --> <sql> <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file> </sql> </install> <uninstall> <!-- Runs on uninstall --> <sql> <file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file> </sql> </uninstall> <files folder="site"> <filename>banners.php</filename> <filename>controller.php</filename> <filename>router.php</filename> <folder>helpers</folder> <folder>models</folder> </files> <administration> <menu img="class:banners">com_banners</menu> <submenu> <!-- Note that all & must be escaped to & for the file to be valid XML and be parsed by the installer --> <menu link="option=com_banners" view="banners" img="class:banners" alt="Banners/Banners" > com_banners_banners </menu> <menu link="option=com_categories&extension=com_banners" view="categories" img="class:banners-cat" alt="Banners/Categories" > com_banners_categories </menu> <menu link="option=com_banners&view=clients" view="clients" img="class:banners-clients" alt="Banners/Clients" > com_banners_clients </menu> <menu link="option=com_banners&view=tracks" view="tracks" img="class:banners-tracks" alt="Banners/Tracks" > com_banners_tracks </menu> </submenu> <files folder="admin"> <filename>access.xml</filename> <filename>banners.php</filename> <filename>config.xml</filename> <filename>controller.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_banners.ini</language> <language tag="en-GB">language/en-GB.com_banners.sys.ini</language> </languages> </administration> </extension> config.xml000064400000005345152326033420006542 0ustar00<?xml version="1.0" encoding="utf-8"?> <config> <fieldset name="component" label="COM_BANNERS_FIELDSET_CONFIG_CLIENT_OPTIONS_LABEL" description="COM_BANNERS_FIELDSET_CONFIG_CLIENT_OPTIONS_DESC" > <field name="purchase_type" type="list" label="COM_BANNERS_FIELD_PURCHASETYPE_LABEL" description="COM_BANNERS_FIELD_PURCHASETYPE_DESC" id="purchase_type" default="1" > <option value="1">COM_BANNERS_FIELD_VALUE_UNLIMITED</option> <option value="2">COM_BANNERS_FIELD_VALUE_YEARLY</option> <option value="3">COM_BANNERS_FIELD_VALUE_MONTHLY</option> <option value="4">COM_BANNERS_FIELD_VALUE_WEEKLY</option> <option value="5">COM_BANNERS_FIELD_VALUE_DAILY</option> </field> <field name="track_impressions" type="radio" label="COM_BANNERS_FIELD_TRACKIMPRESSION_LABEL" description="COM_BANNERS_FIELD_TRACKIMPRESSION_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="track_robots_impressions" type="radio" label="COM_BANNERS_FIELD_TRACKROBOTSIMPRESSION_LABEL" description="COM_BANNERS_FIELD_TRACKROBOTSIMPRESSION_DESC" class="btn-group btn-group-yesno" default="1" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="track_clicks" type="radio" label="COM_BANNERS_FIELD_TRACKCLICK_LABEL" description="COM_BANNERS_FIELD_TRACKCLICK_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="metakey_prefix" type="text" label="COM_BANNERS_FIELD_METAKEYWORDPREFIX_LABEL" description="COM_BANNERS_FIELD_METAKEYWORDPREFIX_DESC" default="" /> </fieldset> <fieldset name="banners" label="COM_BANNERS_FIELDSET_CONFIG_BANNER_OPTIONS_LABEL" description="COM_BANNERS_FIELDSET_CONFIG_BANNER_OPTIONS_DESC" > <field name="save_history" type="radio" label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL" description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC" class="btn-group btn-group-yesno" default="0" > <option value="1">JYES</option> <option value="0">JNO</option> </field> <field name="history_limit" type="number" label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL" description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC" filter="integer" default="10" showon="save_history:1" /> </fieldset> <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_banners" section="component" /> </fieldset> </config> controller.php000064400000003660152326033420007445 0ustar00<?php /** * @package Joomla.Administrator * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** * Banners master display controller. * * @since 1.6 */ class BannersController extends JControllerLegacy { /** * Method to display a view. * * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return BannersController This object to support chaining. * * @since 1.5 */ public function display($cachable = false, $urlparams = array()) { BannersHelper::updateReset(); $view = $this->input->get('view', 'banners'); $layout = $this->input->get('layout', 'default'); $id = $this->input->getInt('id'); // Check for edit form. if ($view == 'banner' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.banner', $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_banners&view=banners', false)); return false; } elseif ($view == 'client' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.client', $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_banners&view=clients', false)); return false; } return parent::display(); } } index.html000064400000000037152326033420006541 0ustar00<!DOCTYPE html><title></title>
/home/digilove/public_html/cache/./../41423/com_banners.tar