From 10463c570802a5ea8dc2ae4c7fd03f4e014f224d Mon Sep 17 00:00:00 2001 From: xevidos Date: Wed, 18 Jul 2018 16:11:02 -0400 Subject: [PATCH] Fixed 500 error in updater. --- components/update/class.update.php | 25 +++++++++++++++++++++---- components/update/dialog.php | 5 +++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/components/update/class.update.php b/components/update/class.update.php index 16039d4..9d2bb57 100755 --- a/components/update/class.update.php +++ b/components/update/class.update.php @@ -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 ) ); } -} +} \ No newline at end of file diff --git a/components/update/dialog.php b/components/update/dialog.php index 9520933..0886d7b 100755 --- a/components/update/dialog.php +++ b/components/update/dialog.php @@ -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);