* @license GNU General Public License, version 2 (GPL-2.0) * * For full copyright and license information, please see * the docs/CREDITS.txt file. * */ namespace phpbb\feed; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Factory class to return correct object */ class factory { /** * Service container object * @var ContainerInterface */ protected $container; /** @var \phpbb\config\config */ protected $config; /** @var \phpbb\db\driver\driver_interface */ protected $db; /** * Constructor * * @param ContainerInterface $container Container object * @param \phpbb\config\config $config Config object * @param \phpbb\db\driver\driver_interface $db Database connection */ public function __construct(ContainerInterface $container, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db) { $this->container = $container; $this->config = $config; $this->db = $db; } /** * Return correct object for specified mode * * @param string $mode The feeds mode. * @param int $forum_id Forum id specified by the script if forum feed provided. * @param int $topic_id Topic id specified by the script if topic feed provided. * * @return object Returns correct feeds object for specified mode. */ function get_feed($mode, $forum_id, $topic_id) { switch ($mode) { case 'forums': if (!$this->config['feed_overall_forums']) { return false; } return $this->container->get('feed.forums'); break; case 'topics': case 'topics_new': if (!$this->config['feed_topics_new']) { return false; } return $this->container->get('feed.topics'); break; case 'topics_active': if (!$this->config['feed_topics_active']) { return false; } return $this->container->get('feed.topics_active'); break; case 'news': // Get at least one news forum $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . ' WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); $result = $this->db->sql_query_limit($sql, 1, 0, 600); $s_feed_news = (int) $this->db->sql_fetchfield('forum_id'); $this->db->sql_freeresult($result); if (!$s_feed_news) { return false; } return $this->container->get('feed.news'); break; default: if ($topic_id && $this->config['feed_topic']) { return $this->container->get('feed.topic') ->set_topic_id($topic_id); } else if ($forum_id && $this->config['feed_forum']) { return $this->container->get('feed.forum') ->set_forum_id($forum_id); } else if ($this->config['feed_overall']) { return $this->container->get('feed.overall'); } return false; break; } } } ux'>topic/extlinux Mageia Installer and base platform for many utilitiesThierry Vignaud [tv]
summaryrefslogtreecommitdiffstats
Commit message (Expand)AuthorAgeFilesLines
* really fix previous button on first step: we want it at install timeThierry Vignaud2004-02-201-1/+1
* keep provider vpi/vci settings when existDamien Chaumette2004-02-201-1/+1
* *** empty log message ***Pascal Rigaux2004-02-201-1/+41
* (update_for_renumbered_partitions):Pascal Rigaux2004-02-201-9/+13
* remove debug statementThierry Vignaud2004-02-201-1/+0
* uim-anthy works ok in on-the-spot mode with KDEPablo Saratxaga2004-02-201-1/+1
* aliase Free non dégroupé 1024/256 on "Free non dégroupé 512/128" (#7615)Thierry Vignaud2004-02-201-0/+3
* Shrink code per Thierry.Stew Benedict2004-02-201-36/+12
* alias agpgart should be only for 2.6, since code doesn't allow this easily,Pascal Rigaux2004-02-202-6/+5
* 10-1mdkThierry Vignaud2004-02-201-1/+5
* fix writing aliases (fix broken speedtouch)Thierry Vignaud2004-02-201-2/+2
* *** empty log message ***Pascal Rigaux2004-02-201-1/+54
* add umask=0022 capability, and use it for security level 3Pascal Rigaux2004-02-201-4/+18
* Gnome is no good, GNOME is goodPascal Rigaux2004-02-202-2/+2
* fix warning LSB chosen implies kernel 2.4Pascal Rigaux2004-02-201-1/+1
* don't force buttons a size related to $::windowwidth since this is no more us...Guillaume Cottenceau2004-02-204-3/+4
* 10.0Guillaume Cottenceau2004-02-201-1/+1
* allow to specify the Xnest wanted resolution with --vgaGuillaume Cottenceau2004-02-201-1/+1
* Gnome icon order. Drop an unused button box.Stew Benedict2004-02-201-53/+28
* 10-0.21mdkThierry Vignaud2004-02-201-1/+11
* since no PCMCIA cards support link status notification, ifplugd shouldThierry Vignaud2004-02-191-1/+3
* updateThierry Vignaud2004-02-191-15103/+17412
* fix stringThierry Vignaud2004-02-191-1/+1
* *** empty log message ***Pascal Rigaux2004-02-191-1/+40
* use $ugtk2::current_window in place of @interactive::objects (which was unuse...Pascal Rigaux2004-02-192-8/+9
* UpdatedArkadiusz Lipiec2004-02-191-14459/+16604
* updated pot filePablo Saratxaga2004-02-1927-357468/+450095
* updated pot filePablo Saratxaga2004-02-19