Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
Once over on files reviewing for 3.5 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed Feb 7, 2016
1 parent cdb5c68 commit 4a5b9f7
Show file tree
Hide file tree
Showing 61 changed files with 511 additions and 643 deletions.
12 changes: 6 additions & 6 deletions com_podcastmanager/admin/controller.php
Expand Up @@ -35,20 +35,19 @@ class PodcastManagerController 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()}.
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return PodcastManagerController Instance of $this to support chaining.
* @return $this
*
* @since 1.6
*/
public function display($cachable = false, $urlparams = [])
{
include_once JPATH_COMPONENT . '/helpers/podcastmanager.php';

$view = $this->input->get('view', $this->default_view, 'word');
$view = $this->input->get('view', $this->default_view, 'word');
$layout = $this->input->get('layout', $this->default_view, 'word');
$id = $this->input->get('id', null, 'int');
$id = $this->input->get('id', null, 'int');

// Check for edit form.
if ($view == 'feed' && $layout == 'edit' && !$this->checkEditId('com_podcastmanager.edit.feed', $id))
Expand All @@ -60,7 +59,8 @@ public function display($cachable = false, $urlparams = [])

return false;
}
elseif ($view == 'podcast' && $layout == 'edit' && !$this->checkEditId('com_podcastmanager.edit.podcast', $id))

if ($view == 'podcast' && $layout == 'edit' && !$this->checkEditId('com_podcastmanager.edit.podcast', $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
Expand Down
6 changes: 3 additions & 3 deletions com_podcastmanager/admin/controllers/feed.php
Expand Up @@ -33,12 +33,12 @@ class PodcastManagerControllerFeed extends JControllerForm
*
* @since 2.0
*/
protected function allowEdit($data = array(), $key = 'id')
protected function allowEdit($data = [], $key = 'id')
{
// Initialise variables.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = JFactory::getUser();
$userId = $user->id;
$user = JFactory::getUser();
$userId = $user->id;

// Check general edit permission first.
if ($user->authorise('core.edit', 'com_podcastmanager'))
Expand Down
2 changes: 1 addition & 1 deletion com_podcastmanager/admin/controllers/feeds.php
Expand Up @@ -34,7 +34,7 @@ class PodcastManagerControllerFeeds extends JControllerAdmin
*
* @since 1.7
*/
public function getModel($name = 'Feed', $prefix = 'PodcastManagerModel', $config = array('ignore_request' => true))
public function getModel($name = 'Feed', $prefix = 'PodcastManagerModel', $config = ['ignore_request' => true])
{
return parent::getModel($name, $prefix, $config);
}
Expand Down
21 changes: 8 additions & 13 deletions com_podcastmanager/admin/controllers/podcast.php
Expand Up @@ -14,6 +14,8 @@

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

/**
* Podcast edit controller class.
*
Expand All @@ -32,22 +34,15 @@ class PodcastManagerControllerPodcast extends JControllerForm
*
* @since 2.0
*/
protected function allowAdd($data = array())
protected function allowAdd($data = [])
{
// Initialise variables.
$user = JFactory::getUser();
$feedId = JArrayHelper::getValue($data, 'feedname', JFactory::getApplication()->input->get('filter_feedname', '', 'int'), 'int');
$allow = null;
$feedId = ArrayHelper::getValue($data, 'feedname', $this->input->get('filter_feedname', '', 'int'), 'int');

if ($feedId)
{
// If the feed has been passed in the data or URL check it.
$allow = $user->authorise('core.create', 'com_podcastmanager.feed.' . $feedId);
}

if ($allow !== null)
{
return $allow;
return JFactory::getUser()->authorise('core.create', 'com_podcastmanager.feed.' . $feedId);
}

// In the absence of better information, revert to the component permissions.
Expand All @@ -64,12 +59,12 @@ protected function allowAdd($data = array())
*
* @since 2.0
*/
protected function allowEdit($data = array(), $key = 'id')
protected function allowEdit($data = [], $key = 'id')
{
// Initialise variables.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = JFactory::getUser();
$userId = $user->get('id');
$user = JFactory::getUser();
$userId = $user->get('id');

// Check feed edit permission.
if ($user->authorise('core.edit', 'com_podcastmanager.podcast.' . $recordId))
Expand Down
2 changes: 1 addition & 1 deletion com_podcastmanager/admin/controllers/podcasts.php
Expand Up @@ -34,7 +34,7 @@ class PodcastManagerControllerPodcasts extends JControllerAdmin
*
* @since 1.6
*/
public function getModel($name = 'Podcast', $prefix = 'PodcastManagerModel', $config = array('ignore_request' => true))
public function getModel($name = 'Podcast', $prefix = 'PodcastManagerModel', $config = ['ignore_request' => true])
{
return parent::getModel($name, $prefix, $config);
}
Expand Down
11 changes: 6 additions & 5 deletions com_podcastmanager/admin/helpers/html/podcast.php
Expand Up @@ -14,6 +14,8 @@

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

/**
* HTML Utility class for Podcast Manager
*
Expand All @@ -40,15 +42,15 @@ abstract class JHtmlPodcast
*
* @since 1.8
*/
public static function feeds($config = array('filter.published' => array(0, 1)))
public static function feeds($config = ['filter.published' => [0, 1]])
{
$hash = md5('com_podcastmanager.' . serialize($config));

if (!isset(static::$items[$hash]))
{
$config = (array) $config;
$db = JFactory::getDbo();
$query = $db->getQuery(true)
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(['a.id', 'a.name']))
->from($db->quoteName('#__podcastmanager_feeds', 'a'));

Expand All @@ -61,8 +63,7 @@ public static function feeds($config = array('filter.published' => array(0, 1)))
}
elseif (is_array($config['filter.published']))
{
JArrayHelper::toInteger($config['filter.published']);
$query->where($db->quoteName('a.published') . ' IN (' . implode(',', $config['filter.published']) . ')');
$query->where($db->quoteName('a.published') . ' IN (' . implode(',', ArrayHelper::toInteger($config['filter.published'])) . ')');
}
}

Expand Down

0 comments on commit 4a5b9f7

Please sign in to comment.