Bearsampp 2025.8.29
Loading...
Searching...
No Matches
ajax.latestversion.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
25
26$result = array(
27 'display' => false,
28 'download' => '',
29);
30
31// Assuming getAppVersion() returns the current version number
33
40Util::logDebug('GitHub Version Data: ' . print_r($githubVersionData, true));
41
42if (!empty($githubVersionData)) {
43 Util::logDebug('GitHub Version Data: ' . print_r($githubVersionData, true));
44} else {
45 Util::logError('No data available in $githubVersionData');
46}
47
53if ($githubVersionData === null) {
54 Util::logError('Failed to retrieve version data from GitHub URL: ' . APP_GITHUB_LATEST_URL);
55 return;
56}
57
66$githubLatestVersionUrl = $githubVersionData['html_url']; // URL of the latest version
69
80 $result['display'] = true;
81 $result['download'] .= '<a role="button" class="btn btn-success fullversionurl" href="' . $githubLatestVersionUrl . '" target="_blank"><i class="fa-solid fa-cloud-arrow-down"></i> ';
82 $result['download'] .= $bearsamppLang->getValue(Lang::DOWNLOAD) . ' <strong>' . APP_TITLE . ' ' . $githubVersionName . '</strong><br />';
83 $result['changelog'] = '';
84}
85
92echo json_encode($result);
$result
global $bearsamppLang
$bearsamppCurrentVersion
global $githubVersionData
$githubVersionName
$githubLatestVersionUrl
$githubLatestVersion
global $bearsamppCore
const DOWNLOAD
static logError($data, $file=null)
static getLatestVersion($url)
static logDebug($data, $file=null)
const APP_GITHUB_LATEST_URL
Definition root.php:19
const APP_TITLE
Definition root.php:13