Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions featherbb/Controller/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use FeatherBB\Core\Lister;
use FeatherBB\Core\Random;
use FeatherBB\Core\Utils;
use FeatherBB\Core\Url;
use FeatherBB\Middleware\Core;

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

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

if (Request::isPost() && empty(Input::getParsedBodyParam('choose_lang'))) {
$missing_fields = array();
Expand Down Expand Up @@ -137,7 +138,7 @@ public function run()
return $this->create_config($data);
}
} else {
$base_url = str_replace('index.php', '', URL::base());
$base_url = str_replace('index.php', '', Url::base());
$data = array('title' => __('My FeatherBB Forum'),
'description' => __('Description'),
'base_url' => $base_url,
Expand Down Expand Up @@ -187,7 +188,7 @@ public function create_db(array $data)
// Init DB
Core::init_db($data);
// Load appropriate language
translate(ForumEnv::get('install', 'featherbb', $data['default_lang']));
translate('install', 'featherbb', $data['default_lang']);

// Create tables
foreach ($this->model->get_database_scheme() as $table => $sql) {
Expand Down
21 changes: 10 additions & 11 deletions featherbb/Controller/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,16 @@ public function display($req, $res, $args)
throw new Error(__('No permission'), 403);
}

return $this->model->delete_user($args['id']);

View::setPageInfo(array(
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Profile'), __('Confirm delete user')),
'active_page' => 'profile',
'username' => $this->model->get_username($args['id']),
'id' => $args['id'],
));

View::addTemplate('profile/delete_user.php')->display();

if (Input::post('delete_user_comply')) {
return $this->model->delete_user($args['id']);
} else {
View::setPageInfo(array(
'title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Profile'), __('Confirm delete user')),
'active_page' => 'profile',
'username' => $this->model->get_username($args['id']),
'id' => $args['id'],
))->addTemplate('profile/delete_user.php')->display();
}
} elseif (Input::post('form_sent')) {

// Fetch the user group of the user we are editing
Expand Down
5 changes: 2 additions & 3 deletions featherbb/Middleware/Csrf.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use RuntimeException;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use FeatherBB\Core\Error;

/**
* CSRF protection middleware.
Expand Down Expand Up @@ -317,9 +318,7 @@ public function getFailureCallable()
{
if (is_null($this->failureCallable)) {
$this->failureCallable = function (ServerRequestInterface $request, ResponseInterface $response, $next) {
$body = new \Slim\Http\Body(fopen('php://temp', 'r+'));
$body->write('Failed CSRF check!');
return $response->withStatus(400)->withHeader('Content-type', 'text/plain')->withBody($body);
throw new Error('Failed CSRF check!', 500);
};
}
return $this->failureCallable;
Expand Down
4 changes: 1 addition & 3 deletions featherbb/Model/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,7 @@ public function delete_user($id)
$this->delete_avatar($id);

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

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

Expand Down
13 changes: 3 additions & 10 deletions featherbb/Model/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,6 @@ public function insert_user($user)

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


if (ForumSettings::get('o_regs_verify') == '0') {
// Regenerate the users info cache
if (!Container::get('cache')->isCached('users_info')) {
Container::get('cache')->store('users_info', Cache::get_users_info());
}

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

// If the mailing list isn't empty, we may need to send out some alerts
if (ForumSettings::get('o_mailing_list') != '') {
// If we previously found out that the email was banned
Expand Down Expand Up @@ -265,6 +255,9 @@ public function insert_user($user)
$jwt = AuthModel::generate_jwt($user_object, $expire);
AuthModel::feather_setcookie('Bearer '.$jwt, $expire);

// Refresh cache
Container::get('cache')->store('users_info', Cache::get_users_info());

Container::get('hooks')->fire('model.register.insert_user');

return Router::redirect(Router::pathFor('home'), __('Reg complete'));
Expand Down
2 changes: 1 addition & 1 deletion featherbb/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

// Profile routes
Route::group('/user', function() {
Route::get('/{id:[0-9]+}', '\FeatherBB\Controller\Profile:display')->setName('userProfile');
Route::map(['GET', 'POST'], '/{id:[0-9]+}', '\FeatherBB\Controller\Profile:display')->setName('userProfile');
Route::map(['GET', 'POST'], '/{id:[0-9]+}/section/{section}', '\FeatherBB\Controller\Profile:display')->setName('profileSection');
Route::map(['GET', 'POST'], '/{id:[0-9]+}/action/{action}', '\FeatherBB\Controller\Profile:action')->setName('profileAction'); // TODO: Move to another route for non-authed users
Route::map(['GET', 'POST'], '/email/{id:[0-9]+}', '\FeatherBB\Controller\Profile:email')->setName('email');
Expand Down
2 changes: 1 addition & 1 deletion plugins/test/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

require __DIR__.'/vendor/autoload.php';
require __DIR__ . '/vendor/autoload.php';

return 'FeatherBB\Plugins\Test';
2 changes: 1 addition & 1 deletion style/themes/FeatherBB/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ section .blocktable .box table tbody tr .tcl .tclcon h3 .newtext a:hover {
text-decoration: underline;
color: #2a6496
}
section .blocktable .box table tbody tr .tcl .tclcon .forumdesc {
section .blocktable .box table tbody tr .tcl .tclcon .forumdesc, .modlist {
font-size: 12px
}
section .blocktable .box table tbody tr .tcr {
Expand Down