Bearsampp 2025.8.29
Loading...
Searching...
No Matches
ajax.nodejs.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (c) 2021-2024 Bearsampp
4 * License: GNU General Public License version 3 or later; see LICENSE.txt
5 * Author: Bear
6 * Website: https://bearsampp.com
7 * Github: https://github.com/Bearsampp
8 */
9
11
23$result = array(
24 'status' => '',
25 'versions' => ''
26);
27
28// Status
34if ($bearsamppBins->getNodejs()->isEnable()) {
35 $result['status'] = '<span class="float-end badge text-bg-success">' . $bearsamppLang->getValue(Lang::ENABLED) . '</span>';
36} else {
37 $result['status'] = '<span class="float-end badge text-bg-danger">' . $bearsamppLang->getValue(Lang::DISABLED) . '</span>';
38}
39
40// Versions
45foreach ($bearsamppBins->getNodejs()->getVersionList() as $version) {
46 if ($version != $bearsamppBins->getNodejs()->getVersion()) {
47 $result['versions'] .= '<span class="m-1 badge text-bg-secondary">' . $version . '</span>';
48 } else {
49 $result['versions'] .= '<span class="m-1 badge text-bg-primary">' . $bearsamppBins->getNodejs()->getVersion() . '</span>';
50 }
51}
52
53// Output the result as a JSON-encoded string
54echo json_encode($result);
$result
global $bearsamppBins
global $bearsamppLang
const DISABLED
const ENABLED