diff --git a/config/services.yml b/config/services.yml index 882fc5fa..796df9b3 100644 --- a/config/services.yml +++ b/config/services.yml @@ -90,6 +90,11 @@ services: tags: - { name: board3.module } + board3.module.clock: + class: \board3\portal\modules\clock + tags: + - { name: board3.module } + board3.module.custom: class: \board3\portal\modules\custom arguments: @@ -102,6 +107,15 @@ services: tags: - { name: board3.module } + board3.module.donation: + class: \board3\portal\modules\donation + arguments: + - @config + - @template + - @user + tags: + - { name: board3.module } + board3.module.forumlist: class: \board3\portal\modules\forumlist arguments: @@ -271,16 +285,13 @@ services: tags: - { name: board3.module } - board3.module.clock: - class: \board3\portal\modules\clock - tags: - - { name: board3.module } - - board3.module.donation: - class: \board3\portal\modules\donation + board3.module.topposters: + class: \board3\portal\modules\topposters arguments: - @config + - @dbal.conn - @template - - @user + - %core.root_path% + - %core.php_ext% tags: - { name: board3.module } diff --git a/migrations/v210_beta1.php b/migrations/v210_beta1.php index b8c6271a..078b2620 100644 --- a/migrations/v210_beta1.php +++ b/migrations/v210_beta1.php @@ -369,7 +369,7 @@ class v210_beta1 extends \phpbb\db\migration\migration 'module_status' => 1, ), array( - 'module_classname' => 'topposters', + 'module_classname' => '\board3\portal\modules\topposters', 'module_column' => 1, 'module_order' => 7, 'module_name' => 'TOPPOSTERS', diff --git a/portal/modules/portal_topposters.php b/modules/topposters.php similarity index 57% rename from portal/modules/portal_topposters.php rename to modules/topposters.php index 34d7833d..f525a7c0 100644 --- a/portal/modules/portal_topposters.php +++ b/modules/topposters.php @@ -1,24 +1,18 @@ 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) { - global $config, $db, $template; - global $phpbb_root_path, $phpEx; - $sql = 'SELECT user_id, username, user_posts, user_colour FROM ' . USERS_TABLE . ' WHERE user_type <> ' . USER_IGNORE . " AND user_posts <> 0 AND username <> '' 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( - 'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'), + $this->template->assign_block_vars('topposters', array( + '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']), 'POSTER_POSTS' => $row['user_posts'], )); } - $db->sql_freeresult($result); + $this->db->sql_freeresult($result); return 'topposters_side.html'; } + /** + * @inheritdoc + */ public function get_template_acp($module_id) { return array( @@ -90,7 +115,7 @@ class portal_topposters_module extends \board3\portal\modules\module_base } /** - * API functions + * @inheritdoc */ public function install($module_id) { @@ -98,6 +123,9 @@ class portal_topposters_module extends \board3\portal\modules\module_base return true; } + /** + * @inheritdoc + */ public function uninstall($module_id, $db) { $del_config = array(