Skip to content

Commit 55e3d0d

Browse files
committed
Merge pull request #84 from featherbb/plugins
Get rid of legacy constants. Restore left menu in admin/plugins.
2 parents edee8b8 + 8f4d30a commit 55e3d0d

File tree

120 files changed

+236
-392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+236
-392
lines changed

featherbb/Controller/Admin/Bans.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,11 @@ public function __construct()
2626
$this->model = new \FeatherBB\Model\Admin\Bans();
2727
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/bans.mo');
2828

29-
if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
29+
if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
3030
throw new Error(__('No permission'), '403');
3131
}
3232
}
3333

34-
public function __autoload($class_name)
35-
{
36-
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
37-
}
38-
3934
public function display()
4035
{
4136
// Display bans

featherbb/Controller/Admin/Categories.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ public function __construct()
2828
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/categories.mo');
2929
}
3030

31-
public function __autoload($class_name)
32-
{
33-
require $this->feather->forum_env['FEATHER_ROOT'].$class_name.'.php';
34-
}
35-
3631
public function add_category()
3732
{
3833
$cat_name = Utils::trim($this->request->post('cat_name'));

featherbb/Controller/Admin/Censoring.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ public function __construct()
2525
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/censoring.mo');
2626
}
2727

28-
public function __autoload($class_name)
29-
{
30-
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
31-
}
32-
3328
public function display()
3429
{
3530
// Add a censor word

featherbb/Controller/Admin/Forums.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ public function __construct()
2727
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/forums.mo');
2828
}
2929

30-
public function __autoload($class_name)
31-
{
32-
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
33-
}
34-
3530
//
3631
// CRUD
3732
//

featherbb/Controller/Admin/Groups.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ public function __construct()
2626
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/groups.mo');
2727
}
2828

29-
public function __autoload($class_name)
30-
{
31-
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
32-
}
33-
3429
public function display()
3530
{
3631
$groups = $this->model->fetch_groups();

featherbb/Controller/Admin/Index.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ public function __construct()
2626
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/index.mo');
2727
}
2828

29-
public function __autoload($class_name)
30-
{
31-
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
32-
}
33-
3429
public function remove_install_folder($directory)
3530
{
3631
foreach(glob("{$directory}/*") as $file)

featherbb/Controller/Admin/Permissions.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ public function __construct()
2525
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/permissions.mo');
2626
}
2727

28-
public function __autoload($class_name)
29-
{
30-
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
31-
}
32-
3328
public function display()
3429
{
3530
// Update permissions

featherbb/Controller/Admin/Plugins.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace FeatherBB\Controller\Admin;
1111

12+
use FeatherBB\Core\AdminUtils;
1213
use FeatherBB\Core\Lister;
1314
use FeatherBB\Core\Error;
1415
use FeatherBB\Core\Utils;
@@ -32,18 +33,20 @@ public function index()
3233
// AdminUtils::generateAdminMenu('plugins');
3334
$this->feather->template->addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript'));
3435

35-
$plugins = Lister::getPlugins();
36-
// var_dump($plugins);
36+
$availablePlugins = Lister::getPlugins();
37+
// var_dump($availablePlugins);
3738
$activePlugins = $this->feather->cache->isCached('active_plugins') ? $this->feather->cache->retrieve('active_plugins') : array();
3839
// var_dump($activePlugins);
3940
// $this->feather->cache->delete('active_plugins');
4041

42+
AdminUtils::generateAdminMenu('plugins');
43+
4144
$this->feather->template->setPageInfo(array(
42-
'admin_console' => true,
43-
'active_page' => 'admin',
44-
'plugins' => $plugins,
45-
'activePlugins' => $activePlugins,
46-
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Extension')),
45+
'admin_console' => true,
46+
'active_page' => 'admin',
47+
'availablePlugins' => $availablePlugins,
48+
'activePlugins' => $activePlugins,
49+
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Extension')),
4750
)
4851
)->addTemplate('admin/plugins.php')->display();
4952
}

featherbb/Controller/Admin/Reports.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ public function __construct()
2525
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/reports.mo');
2626
}
2727

28-
public function __autoload($class_name)
29-
{
30-
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
31-
}
32-
3328
public function display()
3429
{
3530
// Zap a report

featherbb/Controller/Admin/Users.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,11 @@ public function __construct()
2727
load_textdomain('featherbb', $this->feather->forum_env['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/users.mo');
2828
}
2929

30-
public function __autoload($class_name)
31-
{
32-
require $this->feather->forum_env['FEATHER_ROOT'] . $class_name . '.php';
33-
}
34-
3530
public function display()
3631
{
3732
// Move multiple users to other user groups
3833
if ($this->request->post('move_users') || $this->request->post('move_users_comply')) {
39-
if ($this->user->g_id > FEATHER_ADMIN) {
34+
if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
4035
throw new Error(__('No permission'), 403);
4136
}
4237

@@ -54,7 +49,7 @@ public function display()
5449

5550
// Delete multiple users
5651
if ($this->request->post('delete_users') || $this->request->post('delete_users_comply')) {
57-
if ($this->user->g_id > FEATHER_ADMIN) {
52+
if ($this->user->g_id > $this->feather->forum_env['FEATHER_ADMIN']) {
5853
throw new Error(__('No permission'), 403);
5954
}
6055

@@ -72,7 +67,7 @@ public function display()
7267

7368
// Ban multiple users
7469
if ($this->request->post('ban_users') || $this->request->post('ban_users_comply')) {
75-
if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
70+
if ($this->user->g_id != $this->feather->forum_env['FEATHER_ADMIN'] && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
7671
throw new Error(__('No permission'), 403);
7772
}
7873

@@ -107,8 +102,8 @@ public function display()
107102
$paging_links = '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate_old($num_pages, $p, '?find_user=&amp;'.implode('&amp;', $search['query_str']));
108103

109104
// Some helper variables for permissions
110-
$can_delete = $can_move = $this->user->g_id == FEATHER_ADMIN;
111-
$can_ban = $this->user->g_id == FEATHER_ADMIN || ($this->user->g_moderator == '1' && $this->user->g_mod_ban_users == '1');
105+
$can_delete = $can_move = $this->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'];
106+
$can_ban = $this->user->g_id == $this->feather->forum_env['FEATHER_ADMIN'] || ($this->user->g_moderator == '1' && $this->user->g_mod_ban_users == '1');
112107
$can_action = ($can_delete || $can_ban || $can_move) && $num_users > 0;
113108
$this->feather->template->addAsset('js', 'style/imports/common.js', array('type' => 'text/javascript'));
114109

0 commit comments

Comments
 (0)