[feature/module_services] Move topposers to module services
This commit is contained in:
@@ -90,6 +90,11 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: board3.module }
|
- { name: board3.module }
|
||||||
|
|
||||||
|
board3.module.clock:
|
||||||
|
class: \board3\portal\modules\clock
|
||||||
|
tags:
|
||||||
|
- { name: board3.module }
|
||||||
|
|
||||||
board3.module.custom:
|
board3.module.custom:
|
||||||
class: \board3\portal\modules\custom
|
class: \board3\portal\modules\custom
|
||||||
arguments:
|
arguments:
|
||||||
@@ -102,6 +107,15 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: board3.module }
|
- { name: board3.module }
|
||||||
|
|
||||||
|
board3.module.donation:
|
||||||
|
class: \board3\portal\modules\donation
|
||||||
|
arguments:
|
||||||
|
- @config
|
||||||
|
- @template
|
||||||
|
- @user
|
||||||
|
tags:
|
||||||
|
- { name: board3.module }
|
||||||
|
|
||||||
board3.module.forumlist:
|
board3.module.forumlist:
|
||||||
class: \board3\portal\modules\forumlist
|
class: \board3\portal\modules\forumlist
|
||||||
arguments:
|
arguments:
|
||||||
@@ -271,16 +285,13 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: board3.module }
|
- { name: board3.module }
|
||||||
|
|
||||||
board3.module.clock:
|
board3.module.topposters:
|
||||||
class: \board3\portal\modules\clock
|
class: \board3\portal\modules\topposters
|
||||||
tags:
|
|
||||||
- { name: board3.module }
|
|
||||||
|
|
||||||
board3.module.donation:
|
|
||||||
class: \board3\portal\modules\donation
|
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
|
- @dbal.conn
|
||||||
- @template
|
- @template
|
||||||
- @user
|
- %core.root_path%
|
||||||
|
- %core.php_ext%
|
||||||
tags:
|
tags:
|
||||||
- { name: board3.module }
|
- { name: board3.module }
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ class v210_beta1 extends \phpbb\db\migration\migration
|
|||||||
'module_status' => 1,
|
'module_status' => 1,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'module_classname' => 'topposters',
|
'module_classname' => '\board3\portal\modules\topposters',
|
||||||
'module_column' => 1,
|
'module_column' => 1,
|
||||||
'module_order' => 7,
|
'module_order' => 7,
|
||||||
'module_name' => 'TOPPOSTERS',
|
'module_name' => 'TOPPOSTERS',
|
||||||
|
|||||||
@@ -1,24 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package Board3 Portal v2 - Topposters
|
* @package Board3 Portal v2.1
|
||||||
* @copyright (c) Board3 Group ( www.board3.de )
|
* @copyright (c) Board3 Group ( www.board3.de )
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
namespace board3\portal\modules;
|
||||||
* @ignore
|
|
||||||
*/
|
|
||||||
if (!defined('IN_PHPBB'))
|
|
||||||
{
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package Topposters
|
* @package Topposters
|
||||||
*/
|
*/
|
||||||
class portal_topposters_module extends \board3\portal\modules\module_base
|
class topposters extends module_base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
||||||
@@ -47,37 +41,68 @@ class portal_topposters_module extends \board3\portal\modules\module_base
|
|||||||
*/
|
*/
|
||||||
public $language = 'portal_topposters_module';
|
public $language = 'portal_topposters_module';
|
||||||
|
|
||||||
public function get_template_center($module_id)
|
/** @var \phpbb\config\config */
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/** @var \phpbb\db\driver */
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
/** @var \phpbb\template */
|
||||||
|
protected $template;
|
||||||
|
|
||||||
|
/** @var php file extension */
|
||||||
|
protected $php_ext;
|
||||||
|
|
||||||
|
/** @var phpbb root path */
|
||||||
|
protected $phpbb_root_path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a topposers object
|
||||||
|
*
|
||||||
|
* @param \phpbb\config\config $config phpBB config
|
||||||
|
* @param \phpbb\db\driver $db phpBB db driver
|
||||||
|
* @param \phpbb\template $template phpBB template
|
||||||
|
* @param string $phpbb_root_path phpBB root path
|
||||||
|
* @param string $phpEx php file extension
|
||||||
|
*/
|
||||||
|
public function __construct($config, $db, $template, $phpbb_root_path, $phpEx)
|
||||||
{
|
{
|
||||||
return false;
|
$this->config = $config;
|
||||||
|
$this->db = $db;
|
||||||
|
$this->template = $template;
|
||||||
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
$this->php_ext = $phpEx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
public function get_template_side($module_id)
|
public function get_template_side($module_id)
|
||||||
{
|
{
|
||||||
global $config, $db, $template;
|
|
||||||
global $phpbb_root_path, $phpEx;
|
|
||||||
|
|
||||||
$sql = 'SELECT user_id, username, user_posts, user_colour
|
$sql = 'SELECT user_id, username, user_posts, user_colour
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE user_type <> ' . USER_IGNORE . "
|
WHERE user_type <> ' . USER_IGNORE . "
|
||||||
AND user_posts <> 0
|
AND user_posts <> 0
|
||||||
AND username <> ''
|
AND username <> ''
|
||||||
ORDER BY user_posts DESC";
|
ORDER BY user_posts DESC";
|
||||||
$result = $db->sql_query_limit($sql, $config['board3_topposters_' . $module_id]);
|
$result = $this->db->sql_query_limit($sql, $this->config['board3_topposters_' . $module_id]);
|
||||||
|
|
||||||
while (($row = $db->sql_fetchrow($result)))
|
while (($row = $this->db->sql_fetchrow($result)))
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('topposters', array(
|
$this->template->assign_block_vars('topposters', array(
|
||||||
'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'),
|
'S_SEARCH_ACTION' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'author_id=' . $row['user_id'] . '&sr=posts'),
|
||||||
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
|
'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
|
||||||
'POSTER_POSTS' => $row['user_posts'],
|
'POSTER_POSTS' => $row['user_posts'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$this->db->sql_freeresult($result);
|
||||||
|
|
||||||
return 'topposters_side.html';
|
return 'topposters_side.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
public function get_template_acp($module_id)
|
public function get_template_acp($module_id)
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
@@ -90,7 +115,7 @@ class portal_topposters_module extends \board3\portal\modules\module_base
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API functions
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function install($module_id)
|
public function install($module_id)
|
||||||
{
|
{
|
||||||
@@ -98,6 +123,9 @@ class portal_topposters_module extends \board3\portal\modules\module_base
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
public function uninstall($module_id, $db)
|
public function uninstall($module_id, $db)
|
||||||
{
|
{
|
||||||
$del_config = array(
|
$del_config = array(
|
||||||
Reference in New Issue
Block a user