api.php: using depedency injection instead of globals
This commit is contained in:
@@ -1730,7 +1730,11 @@ function buildIndex($global_api = "yes") {
|
||||
$antibot = null;
|
||||
|
||||
if ($config['api']['enabled']) {
|
||||
$api = new Api();
|
||||
$api = new Api(
|
||||
$config['show_filename'],
|
||||
$config['hide_email'],
|
||||
$config['country_flags']
|
||||
);
|
||||
$catalog = array();
|
||||
}
|
||||
|
||||
@@ -2388,7 +2392,11 @@ function buildThread($id, $return = false, $mod = false) {
|
||||
|
||||
// json api
|
||||
if ($config['api']['enabled'] && !$mod) {
|
||||
$api = new Api();
|
||||
$api = new Api(
|
||||
$config['show_filename'],
|
||||
$config['hide_email'],
|
||||
$config['country_flags']
|
||||
);
|
||||
$json = json_encode($api->translateThread($thread));
|
||||
$jsonFilename = $board['dir'] . $config['dir']['res'] . $id . '.json';
|
||||
file_write($jsonFilename, $json);
|
||||
|
||||
Reference in New Issue
Block a user