Skip to content

Commit

Permalink
Simplify sql for overview, remove some deprecated calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mastervanleeuwen committed Jun 23, 2022
1 parent b3975cd commit b37945a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion components/com_jtg/models/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ static public function getCatsData($sort=false, $catid=null)
*
* Used for most popular tracks etc in map view
*/
static public function getTracksData($order, $limit, $where = "",$access = null)
public function getTracksData($order, $limit, $where = "",$access = null)
{
if ( $where != "" )
{
Expand Down
13 changes: 6 additions & 7 deletions components/com_jtg/models/jtg.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct()
protected function getListQuery(){
// TODO: add accesslevel logic, or remove completely? replace by per-track access using native Joomla! logic?
$db = JFactory::getDBO();
$db = $this->getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
$uid = $user->id;
Expand Down Expand Up @@ -113,7 +113,7 @@ function getFile($id)
{
$mainframe = JFactory::getApplication();

$db = JFactory::getDBO();
$db = $this->getDbo();

$query = "SELECT * FROM #__jtg_files WHERE id='" . $id . "'";

Expand All @@ -138,7 +138,7 @@ function getFile($id)
*
* @return Loadobjeclist() track lists extracted from #__jtg_files
*/
static public function getTracksData($order, $limit, $where = "",$access = null)
public function getTracksData($order, $limit, $where = "",$access = null)
{
if ( $where != "" )
{
Expand All @@ -159,12 +159,11 @@ static public function getTracksData($order, $limit, $where = "",$access = null)
}

$mainframe = JFactory::getApplication();
$db = JFactory::getDBO();
$db = $this->getDBO();
$user = JFactory::getUser();
$uid = $user->id;
$query = "SELECT a.*, b.title AS cat FROM #__jtg_files AS a"
. "\n LEFT JOIN #__jtg_cats AS b"
. "\n ON a.catid=b.id WHERE (a.published = 1 OR a.uid='$uid') " . $where
$query = "SELECT a.* FROM #__jtg_files AS a"
. "\n WHERE (a.published = 1 OR a.uid='$uid') " . $where
. "\n" . $order
. "\n" . $limit;
$db->setQuery($query);
Expand Down

0 comments on commit b37945a

Please sign in to comment.