Skip to content

Commit 77de69c

Browse files
committed
Massive rewrite
1 parent bdfe61c commit 77de69c

Some content is hidden

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

62 files changed

+1117
-1367
lines changed

featherbb/Controller/Admin/Bans.php

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,34 @@ class Bans
1818
{
1919
public function __construct()
2020
{
21-
$this->feather = \Slim\Slim::getInstance();
22-
$this->start = $this->feather->start;
23-
$this->config = $this->feather->config;
24-
$this->user = Container::get('user');
25-
$this->request = $this->feather->request;
2621
$this->model = new \FeatherBB\Model\Admin\Bans();
27-
load_textdomain('featherbb', Config::get('forum_env')['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/bans.mo');
22+
load_textdomain('featherbb', Config::get('forum_env')['FEATHER_ROOT'].'featherbb/lang/'.Container::get('user')->language.'/admin/bans.mo');
2823

29-
if ($this->user->g_id != Config::get('forum_env')['FEATHER_ADMIN'] && ($this->user->g_moderator != '1' || $this->user->g_mod_ban_users == '0')) {
24+
if (Container::get('user')->g_id != Config::get('forum_env')['FEATHER_ADMIN'] && (Container::get('user')->g_moderator != '1' || Container::get('user')->g_mod_ban_users == '0')) {
3025
throw new Error(__('No permission'), '403');
3126
}
3227
}
3328

34-
public function display()
29+
public function display($req, $res, $args)
3530
{
3631
Container::get('hooks')->fire('controller.admin.bans.display');
3732

3833
// Display bans
39-
if ($this->request->get('find_ban')) {
34+
if (Input::query('find_ban')) {
4035
$ban_info = $this->model->find_ban();
4136

4237
// Determine the ban offset (based on $_GET['p'])
4338
$num_pages = ceil($ban_info['num_bans'] / 50);
4439

45-
$p = (!$this->request->get('p') || $this->request->get('p') <= 1 || $this->request->get('p') > $num_pages) ? 1 : intval($this->request->get('p'));
40+
$p = (!Input::query('p') || Input::query('p') <= 1 || Input::query('p') > $num_pages) ? 1 : intval(Input::query('p'));
4641
$start_from = 50 * ($p - 1);
4742

4843
$ban_data = $this->model->find_ban($start_from);
4944

5045
View::setPageInfo(array(
5146
'admin_console' => true,
5247
'page' => $p,
53-
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Bans'), __('Results head')),
48+
'title' => array(Utils::escape(Config::get('forum_settings')['o_board_title']), __('Admin'), __('Bans'), __('Results head')),
5449
'paging_links' => '<span class="pages-label">' . __('Pages') . ' </span>' . Url::paginate_old($num_pages, $p, '?find_ban=&amp;' . implode('&amp;', $ban_info['query_str'])),
5550
'ban_data' => $ban_data['data'],
5651
)
@@ -62,17 +57,17 @@ public function display()
6257
View::setPageInfo(array(
6358
'admin_console' => true,
6459
'focus_element' => array('bans', 'new_ban_user'),
65-
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Bans')),
60+
'title' => array(Utils::escape(Config::get('forum_settings')['o_board_title']), __('Admin'), __('Bans')),
6661
)
6762
)->addTemplate('admin/bans/admin_bans.php')->display();
6863
}
6964
}
7065

71-
public function add($id = null)
66+
public function add($req, $res, $args)
7267
{
7368
Container::get('hooks')->fire('controller.admin.bans.add');
7469

75-
if ($this->request->post('add_edit_ban')) {
70+
if (Input::post('add_edit_ban')) {
7671
$this->model->insert_ban();
7772
}
7873

@@ -81,34 +76,34 @@ public function add($id = null)
8176
View::setPageInfo(array(
8277
'admin_console' => true,
8378
'focus_element' => array('bans2', 'ban_user'),
84-
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Bans')),
85-
'ban' => $this->model->add_ban_info($id),
79+
'title' => array(Utils::escape(Config::get('forum_settings')['o_board_title']), __('Admin'), __('Bans')),
80+
'ban' => $this->model->add_ban_info($req, $res, $args),
8681
)
8782
)->addTemplate('admin/bans/add_ban.php')->display();
8883
}
8984

90-
public function delete($id)
85+
public function delete($req, $res, $args)
9186
{
9287
Container::get('hooks')->fire('controller.admin.bans.delete');
9388

9489
// Remove the ban
95-
$this->model->remove_ban($id);
90+
$this->model->remove_ban($req, $res, $args);
9691
}
9792

98-
public function edit($id)
93+
public function edit($req, $res, $args)
9994
{
10095
Container::get('hooks')->fire('controller.admin.bans.edit');
10196

102-
if ($this->request->post('add_edit_ban')) {
97+
if (Input::post('add_edit_ban')) {
10398
$this->model->insert_ban();
10499
}
105100
AdminUtils::generateAdminMenu('bans');
106101

107102
View::setPageInfo(array(
108103
'admin_console' => true,
109104
'focus_element' => array('bans2', 'ban_user'),
110-
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Bans')),
111-
'ban' => $this->model->edit_ban_info($id),
105+
'title' => array(Utils::escape(Config::get('forum_settings')['o_board_title']), __('Admin'), __('Bans')),
106+
'ban' => $this->model->edit_ban_info($req, $res, $args),
112107
)
113108
)->addTemplate('admin/bans/add_ban.php')->display();
114109
}

featherbb/Controller/Admin/Categories.php

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,15 @@ class Categories
1919
{
2020
public function __construct()
2121
{
22-
$this->feather = \Slim\Slim::getInstance();
23-
$this->start = $this->feather->start;
24-
$this->config = $this->feather->config;
25-
$this->user = Container::get('user');
26-
$this->request = $this->feather->request;
2722
$this->model = new \FeatherBB\Model\Admin\Categories();
28-
load_textdomain('featherbb', Config::get('forum_env')['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/categories.mo');
23+
load_textdomain('featherbb', Config::get('forum_env')['FEATHER_ROOT'].'featherbb/lang/'.Container::get('user')->language.'/admin/categories.mo');
2924
}
3025

31-
public function add()
26+
public function add($req, $res, $args)
3227
{
3328
Container::get('hooks')->fire('controller.admin.categories.add');
3429

35-
$cat_name = Utils::trim($this->request->post('cat_name'));
30+
$cat_name = Utils::trim(Input::post('cat_name'));
3631
if ($cat_name == '') {
3732
Router::redirect(Router::pathFor('adminCategories'), __('Must enter name message'));
3833
}
@@ -44,15 +39,15 @@ public function add()
4439
}
4540
}
4641

47-
public function edit()
42+
public function edit($req, $res, $args)
4843
{
4944
Container::get('hooks')->fire('controller.admin.categories.edit');
5045

51-
if (empty($this->request->post('cat'))) {
46+
if (empty(Input::post('cat'))) {
5247
throw new Error(__('Bad request'), '400');
5348
}
5449

55-
foreach ($this->request->post('cat') as $cat_id => $properties) {
50+
foreach (Input::post('cat') as $cat_id => $properties) {
5651
$category = array('id' => (int) $cat_id,
5752
'name' => Utils::escape($properties['name']),
5853
'order' => (int) $properties['order'], );
@@ -69,17 +64,17 @@ public function edit()
6964

7065
}
7166

72-
public function delete()
67+
public function delete($req, $res, $args)
7368
{
7469
Container::get('hooks')->fire('controller.admin.categories.delete');
7570

76-
$cat_to_delete = (int) $this->request->post('cat_to_delete');
71+
$cat_to_delete = (int) Input::post('cat_to_delete');
7772

7873
if ($cat_to_delete < 1) {
7974
throw new Error(__('Bad request'), '400');
8075
}
8176

82-
if (intval($this->request->post('disclaimer')) != 1) {
77+
if (intval(Input::post('disclaimer')) != 1) {
8378
Router::redirect(Router::pathFor('adminCategories'), __('Delete category not validated'));
8479
}
8580

@@ -90,14 +85,14 @@ public function delete()
9085
}
9186
}
9287

93-
public function display()
88+
public function display($req, $res, $args)
9489
{
9590
Container::get('hooks')->fire('controller.admin.categories.display');
9691

9792
AdminUtils::generateAdminMenu('categories');
9893

9994
View::setPageInfo(array(
100-
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Categories')),
95+
'title' => array(Utils::escape(Config::get('forum_settings')['o_board_title']), __('Admin'), __('Categories')),
10196
'active_page' => 'admin',
10297
'admin_console' => true,
10398
'cat_list' => $this->model->get_cat_list(),

featherbb/Controller/Admin/Censoring.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,33 @@ class Censoring
1616
{
1717
public function __construct()
1818
{
19-
$this->feather = \Slim\Slim::getInstance();
20-
$this->start = $this->feather->start;
21-
$this->config = $this->feather->config;
22-
$this->user = Container::get('user');
23-
$this->request = $this->feather->request;
2419
$this->model = new \FeatherBB\Model\Admin\Censoring();
25-
load_textdomain('featherbb', Config::get('forum_env')['FEATHER_ROOT'].'featherbb/lang/'.$this->user->language.'/admin/censoring.mo');
20+
load_textdomain('featherbb', Config::get('forum_env')['FEATHER_ROOT'].'featherbb/lang/'.Container::get('user')->language.'/admin/censoring.mo');
2621
}
2722

28-
public function display()
23+
public function display($req, $res, $args)
2924
{
3025
Container::get('hooks')->fire('controller.admin.censoring.display');
3126

3227
// Add a censor word
33-
if ($this->request->post('add_word')) {
28+
if (Input::post('add_word')) {
3429
$this->model->add_word();
3530
}
3631

3732
// Update a censor word
38-
elseif ($this->request->post('update')) {
33+
elseif (Input::post('update')) {
3934
$this->model->update_word();
4035
}
4136

4237
// Remove a censor word
43-
elseif ($this->request->post('remove')) {
38+
elseif (Input::post('remove')) {
4439
$this->model->remove_word();
4540
}
4641

4742
AdminUtils::generateAdminMenu('censoring');
4843

4944
View::setPageInfo(array(
50-
'title' => array(Utils::escape($this->config['o_board_title']), __('Admin'), __('Censoring')),
45+
'title' => array(Utils::escape(Config::get('forum_settings')['o_board_title']), __('Admin'), __('Censoring')),
5146
'focus_element' => array('censoring', 'new_search_for'),
5247
'active_page' => 'admin',
5348
'admin_console' => true,

0 commit comments

Comments
 (0)