getAuthorisedViewLevels()); $db = Factory::getDBO(); $menu = $app->getMenu(); $document = Factory::getDocument(); $params = $app->getParams(); // Specific category $id = $app->input->get('id', 0, 'int'); // Params $categories = $params->get( 'feed_cat_ids', '' ); $ordering = $params->get( 'feed_img_ordering', 6 ); $imgCount = $params->get( 'feed_img_count', 5 ); $feedTitle = $params->get( 'feed_title', Text::_('COM_PHOCAGALLERY_GALLERY') ); $t['picasa_correct_width_m'] = (int)$params->get( 'medium_image_width', 256 ); $t['picasa_correct_height_m'] = (int)$params->get( 'medium_image_height', 192 ); $document->setTitle($this->escape( html_entity_decode($feedTitle))); if($id > 0) { $wheres[] = ' c.id ='.(int)$id; } else { if (count($categories) > 1) { \Joomla\Utilities\ArrayHelper::toInteger($categories); $categoriesString = implode(',', $categories); $wheres[] = ' c.id IN ( '.$categoriesString.' ) '; } else if ((int)$categories > 0) { $wheres[] = ' c.id IN ( '.$categories.' ) '; } } $imageOrdering = PhocaGalleryOrdering::getOrderingString($ordering, 6); $wheres[] = ' a.published = 1'; $wheres[] = ' a.approved = 1'; $wheres[] = ' c.published = 1'; $wheres[] = ' c.approved = 1'; $wheres[] = ' c.access IN ('.$userLevels.')'; $u = " (c.accessuserid LIKE '%0%' OR c.accessuserid LIKE '%-1%' OR c.accessuserid LIKE '%,".(int)$user->id."' OR c.accessuserid LIKE '".(int)$user->id.",%' OR c.accessuserid LIKE '%,".(int)$user->id.",%' OR c.accessuserid =".(int)$user->id.") "; $e = 'c.accessuserid IS NULL'; $wheres[] = ' CASE WHEN c.accessuserid IS NOT NULL THEN '.$u.' ELSE '.$e.' END'; $query = 'SELECT a.*, c.alias as catalias, c.title as categorytitle' .' FROM #__phocagallery AS a' .' LEFT JOIN #__phocagallery_categories AS c ON a.catid = c.id' . ' WHERE ' . implode( ' AND ', $wheres ) .$imageOrdering['output']; $db->setQuery( $query , 0, $imgCount ); $images = $db->loadObjectList( ); foreach ($images as $keyI => $value) { $item = new FeedItem(); $title = $this->escape( $value->title ); $title = html_entity_decode( $title ); $item->title = $title; $link = PhocaGalleryRoute::getCategoryRoute($value->catid, $value->catalias); $item->link = Route::_($link); // imgDate $imgDate = ''; $imgDate = HTMLHelper::Date($value->date, "Y-m-d h:m:s"); if ($imgDate != '') { $item->date = $imgDate; } $item->description = ''; if ($value->description != '') { $item->description .= '