Merge pull request #795 from Zankaria/api-modern

Modernize (a bit) the Api class
This commit is contained in:
Lorenzo Yario
2024-08-16 21:43:17 -07:00
committed by GitHub
2 changed files with 88 additions and 69 deletions

View File

@@ -1628,7 +1628,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();
}
@@ -2286,7 +2290,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);