PageRenderTime 18ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/administrator/components/com_banners/controller.php

https://bitbucket.org/eternaware/joomus
PHP | 63 lines | 27 code | 10 blank | 26 comment | 9 complexity | cfe0205f81a42f529af42ed5772c4f70 MD5 | raw file
Possible License(s): LGPL-2.1
 1<?php
 2/**
 3 * @package     Joomla.Administrator
 4 * @subpackage  com_banners
 5 *
 6 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 7 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 8 */
 9
10defined('_JEXEC') or die;
11
12/**
13 * Banners master display controller.
14 *
15 * @package     Joomla.Administrator
16 * @subpackage  com_banners
17 * @since       1.6
18 */
19class BannersController extends JControllerLegacy
20{
21	/**
22	 * Method to display a view.
23	 *
24	 * @param	boolean			If true, the view output will be cached
25	 * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
26	 *
27	 * @return	JController		This object to support chaining.
28	 * @since	1.5
29	 */
30	public function display($cachable = false, $urlparams = false)
31	{
32		require_once JPATH_COMPONENT.'/helpers/banners.php';
33		BannersHelper::updateReset();
34
35		$view   = $this->input->get('view', 'banners');
36		$layout = $this->input->get('layout', 'default');
37		$id     = $this->input->getInt('id');
38
39		// Check for edit form.
40		if ($view == 'banner' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.banner', $id)) {
41
42			// Somehow the person just went to the form - we don't allow that.
43			$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
44			$this->setMessage($this->getError(), 'error');
45			$this->setRedirect(JRoute::_('index.php?option=com_banners&view=banners', false));
46
47			return false;
48		}
49		elseif ($view == 'client' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.client', $id)) {
50
51			// Somehow the person just went to the form - we don't allow that.
52			$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
53			$this->setMessage($this->getError(), 'error');
54			$this->setRedirect(JRoute::_('index.php?option=com_banners&view=clients', false));
55
56			return false;
57		}
58
59		parent::display();
60
61		return $this;
62	}
63}