mirror of
https://github.com/easy-wi/developer.git
synced 2025-02-20 11:23:28 +08:00
FIX #919 check for Easy-Wi updates
This commit is contained in:
parent
ec05408859
commit
55ec11aa85
35
reboot.php
35
reboot.php
@ -70,9 +70,43 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
||||
$currentDays = date('t');
|
||||
$currentHour = date('G');
|
||||
}
|
||||
|
||||
$now = date('Y-m-d', strtotime('now'));
|
||||
$sprache = getlanguagefile('gserver', 'uk', 0);
|
||||
|
||||
echo "Fetch Easy-Wi version\r\n";
|
||||
|
||||
licenceRequest();
|
||||
|
||||
$developerVersion = (isset($rSA['developer']) and $rSA['developer'] == 'Y') ? ' developer' : '';
|
||||
|
||||
$query = $sql->prepare("SELECT `version` FROM `easywi_version` ORDER BY `id` DESC LIMIT 1");
|
||||
$query->execute();
|
||||
$installedEasyWiVersion = $query->fetchColumn();
|
||||
|
||||
if (version_compare($rSA['version'], $installedEasyWiVersion) == 1) {
|
||||
|
||||
echo "New Easy-Wi{$developerVersion} version available: {$rSA['version']}\r\n";
|
||||
|
||||
if (date('G') == 5) {
|
||||
|
||||
$updateMail = "A new Easy-Wi{$developerVersion} version is available. The version is {$rSA['version']}.\r\nYou can download it at https://github.com/easy-wi/developer/releases/tag/{$rSA['version']}";
|
||||
|
||||
$query = $sql->prepare("SELECT `id`,`cname`,`mail` FROM `userdata` WHERE `accounttype`='a' AND `active`='Y'");
|
||||
$query->execute();
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (sendmail('easy-wi-update', $row['id'], $updateMail, 'Y')) {
|
||||
echo "Update notification send to user {$row['cname']} ({$row['mail']})\r\n";
|
||||
} else {
|
||||
echo "Sending update notification to user {$row['cname']} ({$row['mail']}) failed\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "You are running the latest Easy-Wi{$developerVersion} version: {$installedEasyWiVersion}.\r\n";
|
||||
}
|
||||
|
||||
echo "Fetch version for Teamspeak 3 Server\r\n";
|
||||
|
||||
$query = $sql->prepare("UPDATE `voice_masterserver` SET `latest_version`=? WHERE `bitversion`=?");
|
||||
@ -435,7 +469,6 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
||||
}
|
||||
|
||||
usleep(500000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ if ($ui->st('d', 'get') == 'ud' and $reseller_id == 0 and $pa['updateEW'] and ve
|
||||
|
||||
$table = array();
|
||||
|
||||
$release = '<div class="right"><a href="https://github.com/easy-wi/developer/releases/tag/'.$ewVersions['version'] . '" target="_blank">' . $vcsprache->releaseNotes . '</a></div>';
|
||||
$release = '<div class="right"><a href="https://github.com/easy-wi/developer/releases/tag/' . $ewVersions['version'] . '" target="_blank">' . $vcsprache->releaseNotes . '</a></div>';
|
||||
$column = ($user_language == 'de') ? 'de' : 'en';
|
||||
|
||||
$query = $sql->prepare("SELECT `version`,`$column` FROM `easywi_version` ORDER BY `id` DESC");
|
||||
|
@ -683,12 +683,18 @@ if (!function_exists('passwordgenerate')) {
|
||||
$email_lastlogin = $row['lastlogin'];
|
||||
}
|
||||
|
||||
if (!isset($resellerid) or !isset($email_country)) {
|
||||
if ($template != 'contact' and $template != 'easy-wi-update' and (!isset($resellerid) or !isset($email_country))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$dataTemplate = array();
|
||||
$email_urlhost = (isset($ui->server['HTTPS'])) ? 'https://' . $ui->server['HTTP_HOST'] . '/login.php' : 'http://' . $ui->server['HTTP_HOST'] . '/login.php';
|
||||
|
||||
// Will not be set in case of console execution
|
||||
if (isset($ui->server['HTTP_HOST'])) {
|
||||
$email_urlhost = (isset($ui->server['HTTPS'])) ? 'https://' . $ui->server['HTTP_HOST'] . '/login.php' : 'http://' . $ui->server['HTTP_HOST'] . '/login.php';
|
||||
} else {
|
||||
$email_urlhost = $rSA['paneldomain'] . '/login.php';
|
||||
}
|
||||
|
||||
$password = $shorten;
|
||||
|
||||
@ -726,7 +732,7 @@ if (!function_exists('passwordgenerate')) {
|
||||
} else if (isset($dataTemplate['subject'])) {
|
||||
//Topic/Subject
|
||||
$topic = $dataTemplate['subject'];
|
||||
} else {
|
||||
} else if ($template != 'contact' and $template != 'easy-wi-update') {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -762,6 +768,10 @@ if (!function_exists('passwordgenerate')) {
|
||||
$mailBody = $server;
|
||||
$usermail = $resellermail;
|
||||
|
||||
} else if ($template == 'easy-wi-update') {
|
||||
$startMail = true;
|
||||
$topic = 'An Easy-Wi update has been released';
|
||||
$mailBody = $server;
|
||||
} else {
|
||||
|
||||
if ($resellerid == $userid) {
|
||||
@ -1221,16 +1231,16 @@ if (!function_exists('passwordgenerate')) {
|
||||
|
||||
$developer = (isset($rSA['developer'])) ? $rSA['developer'] : 'N';
|
||||
|
||||
$apiResponse = webhostRequest('api.github.com', $ui->server['HTTP_HOST'], '/repos/easy-wi/developer/' . (($developer == 'Y') ? 'tags' : 'releases/latest'), null, 443);
|
||||
$apiResponse = webhostRequest('api.github.com', isset($ui->server['HTTP_HOST']) ? $ui->server['HTTP_HOST'] : $rSA['paneldomain'], '/repos/easy-wi/developer/' . (($developer == 'Y') ? 'tags' : 'releases/latest'), null, 443);
|
||||
$json = @json_decode($apiResponse);
|
||||
|
||||
if (($developer == 'N' and is_object($json) and property_exists($json, 'tag_name') or ($developer == 'Y' and is_array($json) and isset($json[0]) and is_object($json[0]) and property_exists($json[0], 'name')))) {
|
||||
|
||||
$varsion = ($developer == 'Y') ? $json[0]->name : $json->tag_name;
|
||||
$apiResponse = array('v' => $varsion);
|
||||
$version = ($developer == 'Y') ? $json[0]->name : $json->tag_name;
|
||||
$apiResponse = array('v' => $version);
|
||||
|
||||
$query = $sql->prepare("UPDATE `settings` SET `version`=? WHERE `resellerid`=0 LIMIT 1");
|
||||
$query->execute(array($varsion));
|
||||
$query->execute(array($version));
|
||||
}
|
||||
|
||||
return ($return == true) ? $apiResponse : false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user