Fixed 500 error in updater.

This commit is contained in:
xevidos 2018-07-18 16:11:02 -04:00
parent f35a290570
commit 10463c5708
2 changed files with 24 additions and 6 deletions

View File

@ -41,7 +41,7 @@ class Update {
$this->archive = "https://gitlab.telaaedifex.com/xevidos/codiad/-/archive/master/codiad-master.zip";
$this->commits = "https://gitlab.telaaedifex.com/api/v4/projects/3/repository/commits/";
$this->tags = "https://gitlab.telaaedifex.com/api/v4/projects/3/repository/tags/";
//$this->protocol = $this->CheckProtocol();
$this->protocol = $this->CheckProtocol();
}
//////////////////////////////////////////////////////////////////
@ -127,11 +127,28 @@ class Update {
//echo var_dump( $response );
//return "[".formatJSEND("success", array("currentversion"=>$local[0]['version'],"remoteversion"=>$latest,"message"=>$message,"archive"=>$archive,"nightly"=>$nightly,"name"=>$local[0]['name']))."]";
return "[".formatJSEND("success", array("currentversion"=>$current_version,"remoteversion"=>$response["name"],"message"=>$response["message"],"archive"=>$archive,"nightly"=>$nightly,"name"=>$response["author_name"]))."]";
}
function CheckProtocol() {
if( extension_loaded( 'curl' ) ) {
//Curl is loaded
return "curl";
} elseif( ini_get('allow_url_fopen') ) {
//Remote get file is enabled
return "fopen";
} else {
//None are enabled exit.
return "none";
}
}
//////////////////////////////////////////////////////////////////
// Get Local Version
//////////////////////////////////////////////////////////////////
@ -187,6 +204,6 @@ class Update {
break;
}
return json_decode(file_get_contents($remoteurl), true);
//return( json_decode( file_get_contents( $remoteurl ), true ) );
}
}
}

View File

@ -12,9 +12,10 @@
// Verify Session or Key
//////////////////////////////////////////////////////////////////
require_once('../../common.php');
checkSession();
switch($_GET['action']){
switch($_GET['action']){
//////////////////////////////////////////////////////////////////////
// Update
@ -32,7 +33,7 @@ checkSession();
} else {
require_once('class.update.php');
require_once('./class.update.php');
$update = new Update();
$vars = json_decode($update->Check(), true);