api.php: using depedency injection instead of globals

This commit is contained in:
fowr
2022-08-05 11:16:53 -03:00
committed by Zankaria
parent 4d8a4db338
commit 4f68166870
2 changed files with 14 additions and 8 deletions

View File

@@ -45,13 +45,11 @@ class Api {
'size' => 'fsize'
];
public function __construct() {
global $config;
public function __construct(bool $show_filename, bool $hide_email, bool $country_flags) {
// Translation from local fields to fields in 4chan-style API
$this->show_filename = $config['show_filename'];
$this->hide_email = $config['hide_email'];
$this->country_flags = $config['country_flags'];
$this->show_filename = $show_filename;
$this->hide_email = $hide_email;
$this->country_flags = $country_flags;
$this->postFields = [
'id' => 'no',