Skip to content

Commit a026237

Browse files
committed
Merge pull request #104 from featherbb/development
Fix installer
2 parents 6f4dc21 + bdab1ad commit a026237

File tree

8 files changed

+23
-33
lines changed

8 files changed

+23
-33
lines changed

featherbb/Controller/Install.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use FeatherBB\Core\Lister;
1313
use FeatherBB\Core\Random;
1414
use FeatherBB\Core\Utils;
15+
use FeatherBB\Core\Url;
1516
use FeatherBB\Middleware\Core;
1617

1718
class Install
@@ -49,7 +50,7 @@ public function run()
4950
$csrf = new \FeatherBB\Middleware\Csrf();
5051
$csrf->generateNewToken(Container::get('request'));
5152

52-
translate(ForumEnv::get('install', 'featherbb', $this->install_lang));
53+
translate('install', 'featherbb', $this->install_lang);
5354

5455
if (Request::isPost() && empty(Input::getParsedBodyParam('choose_lang'))) {
5556
$missing_fields = array();
@@ -137,7 +138,7 @@ public function run()
137138
return $this->create_config($data);
138139
}
139140
} else {
140-
$base_url = str_replace('index.php', '', URL::base());
141+
$base_url = str_replace('index.php', '', Url::base());
141142
$data = array('title' => __('My FeatherBB Forum'),
142143
'description' => __('Description'),
143144
'base_url' => $base_url,
@@ -187,7 +188,7 @@ public function create_db(array $data)
187188
// Init DB
188189
Core::init_db($data);
189190
// Load appropriate language
190-
translate(ForumEnv::get('install', 'featherbb', $data['default_lang']));
191+
translate('install', 'featherbb', $data['default_lang']);
191192

192193
// Create tables
193194
foreach ($this->model->get_database_scheme() as $table => $sql) {

featherbb/Controller/Profile.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,16 @@ public function display($req, $res, $args)
5757
throw new Error(__('No permission'), 403);
5858
}
5959

60-
return $this->model->delete_user($args['id']);
61-
62-
View::setPageInfo(array(
63-
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Profile'), __('Confirm delete user')),
64-
'active_page' => 'profile',
65-
'username' => $this->model->get_username($args['id']),
66-
'id' => $args['id'],
67-
));
68-
69-
View::addTemplate('profile/delete_user.php')->display();
70-
60+
if (Input::post('delete_user_comply')) {
61+
return $this->model->delete_user($args['id']);
62+
} else {
63+
View::setPageInfo(array(
64+
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Profile'), __('Confirm delete user')),
65+
'active_page' => 'profile',
66+
'username' => $this->model->get_username($args['id']),
67+
'id' => $args['id'],
68+
))->addTemplate('profile/delete_user.php')->display();
69+
}
7170
} elseif (Input::post('form_sent')) {
7271

7372
// Fetch the user group of the user we are editing

featherbb/Middleware/Csrf.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use RuntimeException;
99
use Psr\Http\Message\ServerRequestInterface;
1010
use Psr\Http\Message\ResponseInterface;
11+
use FeatherBB\Core\Error;
1112

1213
/**
1314
* CSRF protection middleware.
@@ -317,9 +318,7 @@ public function getFailureCallable()
317318
{
318319
if (is_null($this->failureCallable)) {
319320
$this->failureCallable = function (ServerRequestInterface $request, ResponseInterface $response, $next) {
320-
$body = new \Slim\Http\Body(fopen('php://temp', 'r+'));
321-
$body->write('Failed CSRF check!');
322-
return $response->withStatus(400)->withHeader('Content-type', 'text/plain')->withBody($body);
321+
throw new Error('Failed CSRF check!', 500);
323322
};
324323
}
325324
return $this->failureCallable;

featherbb/Model/Profile.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,9 +729,7 @@ public function delete_user($id)
729729
$this->delete_avatar($id);
730730

731731
// Regenerate the users info cache
732-
if (!Container::get('cache')->isCached('users_info')) {
733-
Container::get('cache')->store('users_info', Cache::get_users_info());
734-
}
732+
Container::get('cache')->store('users_info', Cache::get_users_info());
735733

736734
$stats = Container::get('cache')->retrieve('users_info');
737735

featherbb/Model/Register.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,6 @@ public function insert_user($user)
156156

157157
$new_uid = DB::get_db()->lastInsertId(ForumSettings::get('db_prefix').'users');
158158

159-
160-
if (ForumSettings::get('o_regs_verify') == '0') {
161-
// Regenerate the users info cache
162-
if (!Container::get('cache')->isCached('users_info')) {
163-
Container::get('cache')->store('users_info', Cache::get_users_info());
164-
}
165-
166-
$stats = Container::get('cache')->retrieve('users_info');
167-
}
168-
169159
// If the mailing list isn't empty, we may need to send out some alerts
170160
if (ForumSettings::get('o_mailing_list') != '') {
171161
// If we previously found out that the email was banned
@@ -265,6 +255,9 @@ public function insert_user($user)
265255
$jwt = AuthModel::generate_jwt($user_object, $expire);
266256
AuthModel::feather_setcookie('Bearer '.$jwt, $expire);
267257

258+
// Refresh cache
259+
Container::get('cache')->store('users_info', Cache::get_users_info());
260+
268261
Container::get('hooks')->fire('model.register.insert_user');
269262

270263
return Router::redirect(Router::pathFor('home'), __('Reg complete'));

featherbb/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
// Profile routes
9090
Route::group('/user', function() {
91-
Route::get('/{id:[0-9]+}', '\FeatherBB\Controller\Profile:display')->setName('userProfile');
91+
Route::map(['GET', 'POST'], '/{id:[0-9]+}', '\FeatherBB\Controller\Profile:display')->setName('userProfile');
9292
Route::map(['GET', 'POST'], '/{id:[0-9]+}/section/{section}', '\FeatherBB\Controller\Profile:display')->setName('profileSection');
9393
Route::map(['GET', 'POST'], '/{id:[0-9]+}/action/{action}', '\FeatherBB\Controller\Profile:action')->setName('profileAction'); // TODO: Move to another route for non-authed users
9494
Route::map(['GET', 'POST'], '/email/{id:[0-9]+}', '\FeatherBB\Controller\Profile:email')->setName('email');

plugins/test/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

3-
require __DIR__.'/vendor/autoload.php';
3+
require __DIR__ . '/vendor/autoload.php';
44

55
return 'FeatherBB\Plugins\Test';

style/themes/FeatherBB/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ section .blocktable .box table tbody tr .tcl .tclcon h3 .newtext a:hover {
458458
text-decoration: underline;
459459
color: #2a6496
460460
}
461-
section .blocktable .box table tbody tr .tcl .tclcon .forumdesc {
461+
section .blocktable .box table tbody tr .tcl .tclcon .forumdesc, .modlist {
462462
font-size: 12px
463463
}
464464
section .blocktable .box table tbody tr .tcr {

0 commit comments

Comments
 (0)