mirror of
https://github.com/easy-wi/developer.git
synced 2025-02-20 11:23:28 +08:00
Versioning with Github #915
This commit is contained in:
parent
42d672ebf4
commit
4ce4ac3a2d
@ -72,14 +72,13 @@ $systemCheckError = array();
|
||||
|
||||
if ($currentStep == 0) {
|
||||
|
||||
$licencecode = webhostRequest('l.easy-wi.com', $_SERVER['HTTP_HOST'], '/version.php', null, 80);
|
||||
$licencecode = cleanFsockOpenRequest($licencecode, '{', '}');
|
||||
$json = @json_decode($licencecode);
|
||||
$apiResponse = webhostRequest('api.github.com', $ui->server['HTTP_HOST'], '/repos/easy-wi/developer/releases/latest', null, 443);
|
||||
$json = @json_decode($apiResponse);
|
||||
|
||||
if (!$json or !property_exists($json, 'v') or '5.30' == $json->v) {
|
||||
if (!$json or !is_object($json) or !property_exists($json, 'tag_name') or '5.30' == $json->tag_name) {
|
||||
$displayToUser = "<div class='jumbotron'><h2>{$languageObject->welcome_header}</h2><p>{$languageObject->welcome_text}</p><div class='pager'><a href='?step=1${languageGetParameter}' class='pull-right'><span class='btn btn-primary btn-lg'>{$languageObject->continue}</span></a></div></div>";
|
||||
} else {
|
||||
$displayToUser = "<div class='alert alert-warning'><i class='fa fa-exclamation-triangle'></i> {$languageObject->welcome_old_version}<a href='https://easy-wi.com/uk/downloads/' target='_blank'>{$json->v}</a></div><div class='jumbotron'><h2>{$languageObject->welcome_header}</h2><p>{$languageObject->welcome_text}</p><div class='pager'><a href='?step=1${languageGetParameter}' class='pull-right'><span class='btn btn-primary btn-lg'>{$languageObject->continue}</span></a></div></div>";
|
||||
$displayToUser = "<div class='alert alert-warning'><i class='fa fa-exclamation-triangle'></i> {$languageObject->welcome_old_version}<a href='https://github.com/easy-wi/developer/releases/tag/{$json->tag_name}' target='_blank'>{$json->tag_name}</a></div><div class='jumbotron'><h2>{$languageObject->welcome_header}</h2><p>{$languageObject->welcome_text}</p><div class='pager'><a href='?step=1${languageGetParameter}' class='pull-right'><span class='btn btn-primary btn-lg'>{$languageObject->continue}</span></a></div></div>";
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -743,7 +742,7 @@ if ($currentStep == 7 and count($systemCheckError) == 0) {
|
||||
$query = $sql->prepare("INSERT INTO `page_settings` (`id`,`pageurl`,`resellerid`) VALUES (1,?,0) ON DUPLICATE KEY UPDATE `pageurl`=VALUES(`pageurl`)");
|
||||
$query->execute(array($_POST['installUrl']));
|
||||
|
||||
$query = $sql->prepare("INSERT INTO `settings` (`id`,`template`,`language`,`prefix1`,`prefix2`,`faillogins`,`brandname`,`cronjob_ips`,`licence`,`imageserver`,`resellerid`) VALUES (1,'default',?,?,?,?,?,'','','ew-image.fvip.de::easy-wi',0) ON DUPLICATE KEY UPDATE `language`=VALUES(`language`),`prefix1`=VALUES(`prefix1`),`prefix2`=VALUES(`prefix2`),`faillogins`=VALUES(`faillogins`),`brandname`=VALUES(`brandname`),`imageserver`=VALUES(`imageserver`)");
|
||||
$query = $sql->prepare("INSERT INTO `settings` (`id`,`template`,`language`,`prefix1`,`prefix2`,`faillogins`,`brandname`,`cronjob_ips`,`imageserver`,`resellerid`) VALUES (1,'default',?,?,?,?,?,'','ew-image.fvip.de::easy-wi',0) ON DUPLICATE KEY UPDATE `language`=VALUES(`language`),`prefix1`=VALUES(`prefix1`),`prefix2`=VALUES(`prefix2`),`faillogins`=VALUES(`faillogins`),`brandname`=VALUES(`brandname`),`imageserver`=VALUES(`imageserver`)");
|
||||
$query->execute(array($_POST['language'], $_POST['prefix1'], $_POST['prefix2'], $_POST['faillogins'], $_POST['brandname']));
|
||||
|
||||
$query = $sql->prepare("INSERT INTO `settings_email` (`reseller_id`,`email_setting_name`,`email_setting_value`) VALUES (0,'email',?) ON DUPLICATE KEY UPDATE `email_setting_value`=VALUES(`email_setting_value`)");
|
||||
|
@ -184,6 +184,24 @@ if (versioncheck($version, '5.30', 'update_522-530.php', $response)) {
|
||||
$version = '5.30';
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$query = $sql->prepare("SELECT `developer` FROM `settings` WHERE `resellerid`=0 LIMIT 1");
|
||||
$query->execute();
|
||||
|
||||
if ($query->fetchColumn() == 'Y') {
|
||||
|
||||
$devVersion = '5.32';
|
||||
|
||||
if (versioncheck($version, $devVersion, 'update_developer.php', $response)) {
|
||||
$version = $devVersion;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
//
|
||||
}
|
||||
|
||||
$response->add('Repairing tables if needed.');
|
||||
$tables->correctExistingTables();
|
||||
|
||||
@ -191,8 +209,6 @@ foreach($tables->getExecutedSql() as $change){
|
||||
$response->add($change);
|
||||
}
|
||||
|
||||
include(EASYWIDIR . '/stuff/methods/tables_entries_repair.php');
|
||||
|
||||
# Ende
|
||||
if (!isset($updateinclude) or $updateinclude == false) {
|
||||
$response->add("<br />Database successfully updated!<br /> <b> Please remove the \"install/\" folder and all of it´s content.</b>");
|
||||
|
55
install/update_developer.php
Normal file
55
install/update_developer.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: update_developer.php.
|
||||
* Author: Ulrich Block
|
||||
* Date: 17.08.16
|
||||
* Contact: <ulrich.block@easy-wi.com>
|
||||
*
|
||||
* This file is part of Easy-WI.
|
||||
*
|
||||
* Easy-WI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Easy-WI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Easy-WI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Diese Datei ist Teil von Easy-WI.
|
||||
*
|
||||
* Easy-WI ist Freie Software: Sie koennen es unter den Bedingungen
|
||||
* der GNU General Public License, wie von der Free Software Foundation,
|
||||
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder spaeteren
|
||||
* veroeffentlichten Version, weiterverbreiten und/oder modifizieren.
|
||||
*
|
||||
* Easy-WI wird in der Hoffnung, dass es nuetzlich sein wird, aber
|
||||
* OHNE JEDE GEWAEHELEISTUNG, bereitgestellt; sogar ohne die implizite
|
||||
* Gewaehrleistung der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
|
||||
* Siehe die GNU General Public License fuer weitere Details.
|
||||
*
|
||||
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
|
||||
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (isset($include) and $include == true) {
|
||||
|
||||
|
||||
$query = $sql->prepare("SELECT `version` FROM `easywi_version` WHERE `version`=? LIMIT 1");
|
||||
$query->execute(array($devVersion));
|
||||
|
||||
if ($devVersion != $query->fetchColumn()) {
|
||||
$query = $sql->prepare("INSERT INTO `easywi_version` (`version`,`de`,`en`) VALUES (?,'','')");
|
||||
$query->execute(array($devVersion));
|
||||
}
|
||||
|
||||
$response->add('Action: insert_easywi_version done: ');
|
||||
|
||||
} else {
|
||||
echo "Error: this file needs to be included by the updater!<br />";
|
||||
}
|
@ -52,22 +52,13 @@ if (!isanyadmin($admin_id) and count($pa) == 0) {
|
||||
die('No Access');
|
||||
}
|
||||
|
||||
$ewVersions['files'] = '5.30';
|
||||
|
||||
$vcsprache = getlanguagefile('versioncheck', $user_language, $reseller_id);
|
||||
$query = $sql->prepare("SELECT `version` FROM `easywi_version` ORDER BY `id` DESC LIMIT 1");
|
||||
$query->execute();
|
||||
$ewVersions['cVersion'] = $query->fetchColumn();
|
||||
$ewVersions['version'] = $rSA['version'];
|
||||
|
||||
$query = $sql->prepare("SELECT `version`,`releasenotesDE`,`releasenotesEN` FROM `settings` WHERE `resellerid`=0 LIMIT 1");
|
||||
$query->execute();
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$ewVersions['version'] = $row['version'];
|
||||
$ewVersions['releasenotesDE'] = $row['releasenotesDE'];
|
||||
$ewVersions['releasenotesEN'] = $row['releasenotesEN'];
|
||||
}
|
||||
|
||||
if ($reseller_id == 0 and $ui->st('w', 'get') != 'vc' and (version_compare($ewVersions['version'], $ewVersions['cVersion']) == 1 or version_compare($ewVersions['version'], $ewVersions['files']) == 1)) {
|
||||
if ($reseller_id == 0 and $ui->st('w', 'get') != 'vc' and version_compare($ewVersions['version'], $ewVersions['cVersion']) == 1) {
|
||||
$toooldversion = $vcsprache->newversion.$ewVersions['version'];
|
||||
}
|
||||
|
||||
|
@ -129,6 +129,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$nopassword = $ui->id('nopassword', 1, 'post');
|
||||
$tohighslots = $ui->id('tohighslots', 1, 'post');
|
||||
$cronjobIPs = $ui->ips('cronjobIPs', 'post');
|
||||
$developer = $ui->active('developer', 'post');
|
||||
|
||||
// Panel head data
|
||||
$favicon = $ui->config('favicon', 'post');
|
||||
@ -154,8 +155,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
}
|
||||
|
||||
$query = $sql->prepare("UPDATE `settings` SET `favicon`=?,`header_icon`=?,`header_text`=?,`header_href`=?,`cronjob_ips`=?,`template`=?,`templateColor`=?,`voice_autobackup`=?,`voice_autobackup_intervall`=?,`voice_maxbackup`=?,`language`=?,`imageserver`=?,`master`=?,`prefix1`=?,`prefix2`=?,`faillogins`=?,`brandname`=?,`timezone`=?,`supportnumber`=?,`noservertag`=?,`nopassword`=?,`tohighslots`=?,`down_checks`=?,`lastCronWarnStatus`=?,`lastCronWarnReboot`=?,`lastCronWarnUpdates`=?,`lastCronWarnJobs`=?,`lastCronWarnCloud`=?,`login_header_text`=? WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($favicon, $headerIcon, $headerText, $headerHref, $cronjobIPs, $template, $templateColor, $voice_autobackup, $voice_autobackup_intervall, $voice_maxbackup, $language, $imageserver, $master, $prefix1, $prefix2, $faillogins, $brandname, $timezone, $supportnumber, $noservertag, $nopassword, $tohighslots, $down_checks, $lastCronWarnStatus, $lastCronWarnReboot, $lastCronWarnUpdates, $lastCronWarnJobs, $lastCronWarnCloud, $loginHeaderText, $reseller_id));
|
||||
$query = $sql->prepare("UPDATE `settings` SET `developer`=?,`favicon`=?,`header_icon`=?,`header_text`=?,`header_href`=?,`cronjob_ips`=?,`template`=?,`templateColor`=?,`voice_autobackup`=?,`voice_autobackup_intervall`=?,`voice_maxbackup`=?,`language`=?,`imageserver`=?,`master`=?,`prefix1`=?,`prefix2`=?,`faillogins`=?,`brandname`=?,`timezone`=?,`supportnumber`=?,`noservertag`=?,`nopassword`=?,`tohighslots`=?,`down_checks`=?,`lastCronWarnStatus`=?,`lastCronWarnReboot`=?,`lastCronWarnUpdates`=?,`lastCronWarnJobs`=?,`lastCronWarnCloud`=?,`login_header_text`=? WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($developer, $favicon, $headerIcon, $headerText, $headerHref, $cronjobIPs, $template, $templateColor, $voice_autobackup, $voice_autobackup_intervall, $voice_maxbackup, $language, $imageserver, $master, $prefix1, $prefix2, $faillogins, $brandname, $timezone, $supportnumber, $noservertag, $nopassword, $tohighslots, $down_checks, $lastCronWarnStatus, $lastCronWarnReboot, $lastCronWarnUpdates, $lastCronWarnJobs, $lastCronWarnCloud, $loginHeaderText, $reseller_id));
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
$loguseraction = "%mod% %settings%";
|
||||
@ -176,6 +177,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT * FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($reseller_id));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$developer = $row['developer'];
|
||||
$favicon = $row['favicon'];
|
||||
$headerIcon = $row['header_icon'];
|
||||
$headerText = $row['header_text'];
|
||||
|
@ -48,7 +48,7 @@ $logusertype = 'admin';
|
||||
$logreseller = 0;
|
||||
$logsubuser = 0;
|
||||
|
||||
if ($ui->st('d', 'get') == 'ud' and $reseller_id == 0 and $pa['updateEW'] and ($ewVersions['cVersion'] < $ewVersions['version'] or $ewVersions['files'] < $ewVersions['version'])) {
|
||||
if ($ui->st('d', 'get') == 'ud' and $reseller_id == 0 and $pa['updateEW'] and version_compare($ewVersions['version'], $ewVersions['cVersion']) == 1) {
|
||||
|
||||
if ($ui->w('action', 4, 'post') == 'ud') {
|
||||
|
||||
@ -119,7 +119,7 @@ if ($ui->st('d', 'get') == 'ud' and $reseller_id == 0 and $pa['updateEW'] and ($
|
||||
|
||||
$response->add('Downloading: ' . $licenceDetails['v'] . '.zip');
|
||||
|
||||
$fp = @fopen('http://update.easy-wi.com/ew/' . $licenceDetails['v'] . '.zip', 'rb', false, $opts);
|
||||
$fp = @fopen('https://api.github.com/repos/easy-wi/developer/zipball/' . $licenceDetails['v'], 'rb', false, $opts);
|
||||
$zip = @fopen(EASYWIDIR . '/tmp/' . $licenceDetails['v'] . '.zip', 'wb');
|
||||
|
||||
if ($fp == true and $zip == true) {
|
||||
@ -280,15 +280,8 @@ if ($ui->st('d', 'get') == 'ud' and $reseller_id == 0 and $pa['updateEW'] and ($
|
||||
|
||||
$table = array();
|
||||
|
||||
if ($user_language == 'de') {
|
||||
$column = 'de';
|
||||
$release = 'releasenotesDE';
|
||||
} else {
|
||||
$column = 'en';
|
||||
$release = 'releasenotesEN';
|
||||
}
|
||||
|
||||
$release = '<div class="right"><a href="https://easy-wi.com/forum/showthread.php?tid='.$ewVersions[$release] . '" 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");
|
||||
$query->execute();
|
||||
@ -305,11 +298,6 @@ if ($ui->st('d', 'get') == 'ud' and $reseller_id == 0 and $pa['updateEW'] and ($
|
||||
$class = 'versioncheckbad';
|
||||
$isok = $vcsprache->outdated . ' ' . $ewVersions['cVersion'] . ' ' . $vcsprache->latestversion . ' ' . $ewVersions['version'] . '.' . $release . ' ' . $update;
|
||||
|
||||
} else if (version_compare($ewVersions['version'], $ewVersions['files']) == 1) {
|
||||
$state = 1;
|
||||
$class = 'versioncheckbad';
|
||||
$isok = $vcsprache->filesoutdated . ' ' . $ewVersions['cVersion'] . '. '.$vcsprache->latestversion . ' ' . $ewVersions['version'] . '.' . $release . ' ' . $update;
|
||||
|
||||
} else {
|
||||
$state = 2;
|
||||
$class = 'versioncheckok';
|
||||
|
@ -40,8 +40,6 @@
|
||||
$defined['settings'] = array(
|
||||
'id' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>"auto_increment"),
|
||||
'version' => array("Type"=>"varchar(10)","Null"=>"YES","Key"=>"","Default"=>"5.30","Extra"=>""),
|
||||
'releasenotesDE' => array("Type"=>"int(11) unsigned","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'releasenotesEN' => array("Type"=>"int(11) unsigned","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'favicon' => array("Type"=>"varchar(100)","Null"=>"YES","Key"=>"","Default"=>"images/favicon.ico","Extra"=>""),
|
||||
'header_icon' => array("Type"=>"varchar(100)","Null"=>"YES","Key"=>"","Default"=>"logo_180px.png","Extra"=>""),
|
||||
'header_text' => array("Type"=>"varchar(100)","Null"=>"YES","Key"=>"","Default"=>"Easy-Wi","Extra"=>""),
|
||||
@ -51,7 +49,6 @@ $defined['settings'] = array(
|
||||
'templateColor' => array("Type"=>"varchar(50)","Null"=>"YES","Key"=>"","Default"=>"blue","Extra"=>""),
|
||||
'imageserver' => array("Type"=>"text","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'cronjob_ips' => array("Type"=>"text","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'licence' => array("Type"=>"text","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'master' => array("Type"=>"enum('Y','N')","Null"=>"NO","Key"=>"","Default"=>"N","Extra"=>""),
|
||||
'voice_autobackup' => array("Type"=>"enum('Y','N')","Null"=>"YES","Key"=>"","Default"=>"Y","Extra"=>""),
|
||||
'voice_autobackup_intervall' => array("Type"=>"smallint(5) unsigned","Null"=>"YES","Key"=>"","Default"=>"5","Extra"=>""),
|
||||
@ -67,6 +64,7 @@ $defined['settings'] = array(
|
||||
'tohighslots' => array("Type"=>"smallint(1) unsigned","Null"=>"NO","Key"=>"","Default"=>"1","Extra"=>""),
|
||||
'paneldomain' => array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'down_checks' => array("Type"=>"smallint(5) unsigned","Null"=>"YES","Key"=>"","Default"=>"2","Extra"=>""),
|
||||
'developer' => array("Type"=>"enum('Y','N')","Null"=>"YES","Key"=>"","Default"=>"N","Extra"=>""),
|
||||
'lastUpdateRun' => array("Type"=>"smallint(2) unsigned","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'lastCronStatus' => array("Type"=>"int(11) unsigned","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'lastCronWarnStatus' => array("Type"=>"enum('Y','N')","Null"=>"NO","Key"=>"","Default"=>"Y","Extra"=>""),
|
||||
|
@ -268,11 +268,7 @@ if (!function_exists('passwordgenerate')) {
|
||||
|
||||
function serverAmount($resellerid) {
|
||||
|
||||
global $sql, $user_language;
|
||||
|
||||
$query = $sql->prepare("SELECT `licence` FROM `settings` WHERE `resellerid`=0 LIMIT 1");
|
||||
$query->execute();
|
||||
$json = @json_decode($query->fetchColumn());
|
||||
global $sql, $user_language, $rSA;
|
||||
|
||||
$query = $sql->prepare("SELECT COUNT(g.`id`) AS `amount` FROM `gsswitch` g LEFT JOIN `userdata` u ON g.`userid`=u.`id` LEFT JOIN `userdata` r ON g.`resellerid`= r.`id` WHERE g.`active`='Y' AND u.`active`='Y' AND (r.`active`='Y' OR r.`active` IS NULL)");
|
||||
$query->execute();
|
||||
@ -332,7 +328,7 @@ if (!function_exists('passwordgenerate')) {
|
||||
$dCount = (int) $query->fetchColumn();
|
||||
}
|
||||
|
||||
return array('left' => $left, 'count' => $count, 'gsCount' => $gsCount, 'vCount' => $vCount, 'voCount' => $voCount, 'dCount' => $dCount, 'mG' => $mG, 'mVs' => $mVs, 'mVo' => $mVo, 'mD' => $mD, 'lG' => $lG, 'lVs' => $lVs, 'lVo' => $lVo, 'lD' => $lD, 'p' => $json->p, 'b' => $json->b, 't' => $json->t, 'u' => $json->u, 'c' => $json->c, 'v' => $json->v);
|
||||
return array('left' => $left, 'count' => $count, 'gsCount' => $gsCount, 'vCount' => $vCount, 'voCount' => $voCount, 'dCount' => $dCount, 'mG' => $mG, 'mVs' => $mVs, 'mVo' => $mVo, 'mD' => $mD, 'lG' => $lG, 'lVs' => $lVs, 'lVo' => $lVo, 'lD' => $lD, 'p' => 'Y', 'b' => 'Y', 't' => 'g', 'u' => 'U', 'c' => 'B', 'v' => $rSA['version']);
|
||||
}
|
||||
|
||||
function getusername($userid) {
|
||||
@ -1043,6 +1039,10 @@ if (!function_exists('passwordgenerate')) {
|
||||
|
||||
$domain = str_replace(array('https://', 'http://'),'', $domain);
|
||||
|
||||
if ($port == 443) {
|
||||
$domain = 'ssl://' . $domain;
|
||||
}
|
||||
|
||||
if (isdomain($domain)) {
|
||||
$fp = @fsockopen($domain, $port, $errno, $errstr, 10);
|
||||
} else {
|
||||
@ -1217,26 +1217,23 @@ if (!function_exists('passwordgenerate')) {
|
||||
|
||||
function licenceRequest($return = false) {
|
||||
|
||||
global $sql, $ui;
|
||||
global $sql, $ui, $rSA;
|
||||
|
||||
$licencecode = webhostRequest('l.easy-wi.com', $ui->server['HTTP_HOST'], '/licence.php', null, 80);
|
||||
$licencecode = cleanFsockOpenRequest($licencecode, '{', '}');
|
||||
$json = @json_decode($licencecode);
|
||||
$developer = (isset($rSA['developer'])) ? $rSA['developer'] : 'N';
|
||||
|
||||
if ($json and isset($json->v)) {
|
||||
$licencecode = array();
|
||||
$apiResponse = webhostRequest('api.github.com', $ui->server['HTTP_HOST'], '/repos/easy-wi/developer/' . (($developer == 'Y') ? 'tags' : 'releases/latest'), null, 443);
|
||||
$json = @json_decode($apiResponse);
|
||||
|
||||
foreach($json as $k => $v) {
|
||||
$licencecode[$k] = $v;
|
||||
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);
|
||||
|
||||
$query = $sql->prepare("UPDATE `settings` SET `version`=? WHERE `resellerid`=0 LIMIT 1");
|
||||
$query->execute(array($varsion));
|
||||
}
|
||||
|
||||
$licencecode['lt'] = time();
|
||||
$licencecode = json_encode($licencecode);
|
||||
|
||||
$query2 = $sql->prepare("UPDATE `settings` SET `licence`=?,`version`=?,`releasenotesDE`=?,`releasenotesEN`=? WHERE `resellerid`=0 LIMIT 1");
|
||||
$query2->execute(array($licencecode, $json->v, $json->de, $json->en));
|
||||
}
|
||||
return ($return == true) ? $licencecode : false;
|
||||
return ($return == true) ? $apiResponse : false;
|
||||
}
|
||||
|
||||
function token ($check = false) {
|
||||
|
@ -101,8 +101,7 @@ try {
|
||||
$loguserip = 'localhost';
|
||||
$userHostname = 'localhost';
|
||||
}
|
||||
}
|
||||
catch(PDOException $error) {
|
||||
} catch(PDOException $error) {
|
||||
die($error->getMessage());
|
||||
}
|
||||
|
||||
|
@ -151,6 +151,16 @@
|
||||
<input class="form-control" id="inputLoginText" type="text" name="loginheadertext" value="<?php echo $loginHeaderText;?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputDeveloper">Developer Version</label>
|
||||
<div class="controls">
|
||||
<select class="form-control" id="inputDeveloper" name="developer">
|
||||
<option value="N"><?php echo $gsprache->no;?></option>
|
||||
<option value="Y" <?php if($developer=='Y') echo 'selected="selected"';?>><?php echo $gsprache->yes;?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-primary">
|
||||
|
Loading…
x
Reference in New Issue
Block a user