Skip to content

Commit

Permalink
Move to Joomla\Database\QueryInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
810 committed Jun 5, 2019
1 parent a4ce5ec commit 42e869a
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 162 deletions.
20 changes: 10 additions & 10 deletions src/components/com_kunena/views/topic/view.raw.php
Expand Up @@ -21,10 +21,10 @@
class KunenaViewTopic extends KunenaView
{
/**
* @param null $tpl tpl
* @param null $tpl tpl
*
* @throws Exception
* @since Kunena
* @throws Exception
*/
public function displayEdit($tpl = null)
{
Expand All @@ -50,13 +50,13 @@ public function displayEdit($tpl = null)
/**
* Return JSON results of smilies available
*
* @param string $tpl tpl
* @param string $tpl tpl
*
* @return void
* @throws Exception
* @since K4.0
*
* @since Kunena
* @throws Exception
*/
public function displayListEmoji($tpl = null)
{
Expand All @@ -67,7 +67,7 @@ public function displayListEmoji($tpl = null)
$search = $this->app->input->get('search');

$db = Factory::getDBO();
$kquery = new KunenaDatabaseQuery;
$kquery = $db->getQuery(true);
$kquery->select('*')->from("{$db->quoteName('#__kunena_smileys')}")->where("code LIKE '%{$db->escape($search)}%' AND emoticonbar=1");
$db->setQuery($kquery);

Expand Down Expand Up @@ -104,8 +104,8 @@ public function displayListEmoji($tpl = null)
* Send list of topic icons in JSON for the category set selected
*
* @return void
* @throws Exception
* @since Kunena
* @throws Exception
*/
public function displayTopicIcons()
{
Expand Down Expand Up @@ -215,10 +215,10 @@ public function displayGetrate()
/**
* Save rate for user logged in by JSON call
*
* @param null $tpl tpl
* @param null $tpl tpl
*
* @throws Exception
* @since Kunena
* @throws Exception
*/
public function displayRate($tpl = null)
{
Expand Down Expand Up @@ -254,10 +254,10 @@ public function displayRate($tpl = null)
/**
* Return the template text corresponding to the category selected
*
* @param null $tpl tpl
* @param null $tpl tpl
*
* @throws Exception
* @since Kunena 5.1
* @throws Exception
*/
public function displayCategorytemplatetext($tpl = null)
{
Expand Down
15 changes: 8 additions & 7 deletions src/libraries/kunena/access.php
Expand Up @@ -901,10 +901,11 @@ public function getSubscribers($catid, $topic, $type = false, $moderators = fals
$adminlist = array();
}

$query = new KunenaDatabaseQuery;
$query->select('u.id, u.name, u.username, u.email');
$query->from('#__users AS u');
$query->where("u.block=0");
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select('u.id, u.name, u.username, u.email')
->from('#__users AS u')
->where("u.block=0");
$userlist = array();

if (!empty($subslist))
Expand Down Expand Up @@ -1006,7 +1007,7 @@ public function loadSubscribers(KunenaForumTopic $topic, $type)
$querytopic = $db->getQuery(true)
->select($db->quoteName('user_id'))
->from($db->quoteName('#__kunena_user_topics', 'ut'))
->leftJoin($db->quoteName('#__kunena_users','ku') . ' ON ' . $db->quoteName('ut.user_id') . ' = ' . $db->quoteName('ku.userid'))
->leftJoin($db->quoteName('#__kunena_users', 'ku') . ' ON ' . $db->quoteName('ut.user_id') . ' = ' . $db->quoteName('ku.userid'))
->where($db->quoteName('ut.topic_id') . ' = ' . $db->quote($topic->id))
->where($db->quoteName('ut.subscribed') . ' = 1')
->where($db->quoteName('ku.banned') . ' <> 0')
Expand All @@ -1024,15 +1025,15 @@ public function loadSubscribers(KunenaForumTopic $topic, $type)
$querycat = $db->getQuery(true)
->select($db->quoteName('user_id'))
->from($db->quoteName('#__kunena_user_categories', 'ut'))
->leftJoin($db->quoteName('#__kunena_users','ku') . ' ON ' . $db->quoteName('ut.user_id') . ' = ' . $db->quoteName('ku.userid'))
->leftJoin($db->quoteName('#__kunena_users', 'ku') . ' ON ' . $db->quoteName('ut.user_id') . ' = ' . $db->quoteName('ku.userid'))
->where($db->quoteName('category_id') . ' = ' . $db->quote($category->id))
->andWhere($db->quoteName('ut.subscribed') . ' = 1')
->andWhere($db->quoteName('ku.banned') . ' <> 0')
->orWhere($db->quoteName('ku.banned') . ' IS NULL')
->andWhere($db->quoteName('category_id') . ' = ' . $db->quote($category->id))
->andWhere($db->quoteName('ut.subscribed') . ' = 1')
->group($db->quoteName('user_id'));
$query[] = $querycat;
$query[] = $querycat;
}

$query = implode(' UNION ', $query);
Expand Down

0 comments on commit 42e869a

Please sign in to comment.