1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/objects/pluginsAvailable.json.php
Caleb Mazalevskis 27a7925b98
Refactor.
2022-01-06 21:44:29 +08:00

34 lines
824 B
PHP

<?php
global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
if (!User::isAdmin()) {
forbiddenPage();
}
header('Content-Type: application/json');
$row = Plugin::getAvailablePlugins(true);
$total = count($row);
if (!User::isAdmin()) {
foreach ($row as $key => $value) {
if (!empty($row[$key]->installedPlugin['object_data'])) {
$row[$key]->installedPlugin['object_data'] = '';
}
}
}
$json = _json_encode($row);
if (empty($json)) {
_error_log(print_r($row, true));
// remove object data
foreach ($row as $key => $value) {
$row[$key]->installedPlugin['object_data'] = '';
}
$json = _json_encode($row);
}
echo '{ "current": 1,"rowCount": '.$total.', "total": '.$total.', "rows":'. $json.'}';