Skip to content
Permalink
Browse files

include in loop if f_read is yes

  • Loading branch information...
alifaraji committed Nov 13, 2014
1 parent ec5b2ec commit 8b7e6126ad28ce0563bbc0444ea63bbd01e4a2cd
@@ -7,6 +7,7 @@ services:
- @config
- @dbal.conn
- @user
- @auth
- %core.root_path%
- %core.php_ext%
tags:
@@ -47,20 +47,24 @@ static public function getSubscribedEvents()
/** @var \phpbb\user */
protected $user;
/** @var \phpbb\auth\auth */
protected $auth;
/** @var string phpBB root path */
protected $root_path;
/** @var string PHP extension */
protected $phpEx;
public function __construct(\phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $root_path, $phpEx)
public function __construct(\phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\auth\auth $auth, $root_path, $phpEx)
{
$this->helper = $helper;
$this->template = $template;
$this->config = $config;
$this->db = $db;
$this->user = $user;
$this->auth = $auth;
$this->root_path = $root_path;
$this->phpEx = $phpEx;
}
@@ -90,10 +94,11 @@ public function count_posts($id)
public function get_topic_list()
{
$sql = 'SELECT topic_title, topic_time, topic_views, topic_poster, topic_first_poster_name, topic_first_poster_colour, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time, topic_last_post_id, topic_id, forum_id
$sql = 'SELECT forum_id, topic_title, topic_time, topic_views, topic_poster, topic_first_poster_name, topic_first_poster_colour, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time, topic_last_post_id, topic_id, forum_id
FROM ' . TOPICS_TABLE . ' AS data
JOIN (SELECT (FLOOR(RAND() * (SELECT MAX(topic_id) FROM '.TOPICS_TABLE.'))) AS random_id) as random
WHERE data.topic_id >= random.random_id ';
WHERE '. $this->db->sql_in_set('forum_id', array_keys($this->auth->acl_getf('f_read', true))) .'
AND data.topic_id >= random.random_id';
$limit = $this->config['rtopics_limit'];
$result = $this->db->sql_query_limit($sql, $limit);
@@ -0,0 +1,31 @@
<?php
/**
*
* @package Random Topics
* @copyright (c) 2014 Ali Faraji <alifaraji.mail@gmail.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
$lang = array_merge($lang, array(
'ACP_RANDOMTOPICS' => 'موضوعات اتفاقی',
'ACP_RANDOMTOPICS_SETTINGS' => 'تنظیمات',
'ACP_RTOPICS_LIMIT' => 'محدودیت تعداد موضوع',
'ACP_LIMIT_ACTIVE_EXP' => 'تعداد موضوعی که در لیست نمایش داده شود',
'ACP_RANDOMTOPICS_TITLE' => 'موضوعات اتفاقی',
'ACP_RTOPICS_ACTIVE' => 'موضوعات اتفاقی فعال شود؟',
'ACP_RTOPICS_ACTIVE_EXP' => 'فعال سازی/غیرفعال سازی افزونه',
'ACP_RTOPICS_SETTING_SAVED' => 'تنظیمات با موفقیت بروز شدند.',
'ACP_RTOPICS_INDEX' => 'نمایش موضوعات اتفاقی در صفحه اصلی',
'ACP_RTOPICS_INDEX_EXP' => 'لیست موضوعات اتفاقی در صفحه اصلی نمایش داده خواهند شد.',
'ACP_RTOPICS_VIEWTOPIC' => 'نمایش موضوعات اتفاقی در صفحه موضوعات',
'ACP_RTOPICS_VIEWTOPIC_EXP' => 'موضوعات اتفاقی در صفحه موضوعات نمایش داده خواهند شد.',
));
@@ -0,0 +1,20 @@
<?php
/**
*
* @package Random Topics
* @copyright (c) 2014 Ali Faraji <alifaraji.mail@gmail.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
$lang = array_merge($lang, array(
'RANDOM_TOPICS' => 'موضوعات اتفاقی',
));
File renamed without changes.

0 comments on commit 8b7e612

Please sign in to comment.
You can’t perform that action at this time.