From 03727b01cedc76a20a65bd471a04947c465c400b Mon Sep 17 00:00:00 2001 From: mkuba50 Date: Fri, 29 Sep 2017 23:40:56 +0200 Subject: [PATCH] Fix API not working when parent script uses include with the same name --- fetchupd.php | 4 ++-- get.php | 6 +++--- listeditions.php | 5 +++-- listid.php | 2 +- listlangs.php | 5 +++-- shared/main.php | 2 +- updateinfo.php | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/fetchupd.php b/fetchupd.php index dd390b6..315730c 100644 --- a/fetchupd.php +++ b/fetchupd.php @@ -15,8 +15,8 @@ See the License for the specific language governing permissions and limitations under the License. */ -require_once 'shared/main.php'; -require_once 'shared/requests.php'; +require_once dirname(__FILE__).'/shared/main.php'; +require_once dirname(__FILE__).'/shared/requests.php'; function uupFetchUpd($arch = 'amd64', $ring = 'WIF', $flight = 'Active', $build = '16251') { uupApiPrintBrand(); diff --git a/get.php b/get.php index b9a7298..a0331ed 100644 --- a/get.php +++ b/get.php @@ -15,11 +15,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -require_once 'shared/main.php'; -require_once 'shared/requests.php'; +require_once dirname(__FILE__).'/shared/main.php'; +require_once dirname(__FILE__).'/shared/requests.php'; function uupGetFiles($updateId = 'c2a1d787-647b-486d-b264-f90f3782cdc6', $usePack = 0, $desiredEdition = 0) { - require 'shared/packs.php'; + require dirname(__FILE__).'/shared/packs.php'; uupApiPrintBrand(); function packsByEdition($edition, $pack, $lang, $filesKeys) { diff --git a/listeditions.php b/listeditions.php index 81374fd..cf203f7 100644 --- a/listeditions.php +++ b/listeditions.php @@ -15,9 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. */ +require_once dirname(__FILE__).'/shared/main.php'; + function uupListEditions($lang = 'en-us') { - require_once 'shared/main.php'; - require 'shared/packs.php'; + require dirname(__FILE__).'/shared/packs.php'; if($lang) { $lang = strtolower($lang); diff --git a/listid.php b/listid.php index b7d99e9..ba2e94a 100644 --- a/listid.php +++ b/listid.php @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -require_once 'shared/main.php'; +require_once dirname(__FILE__).'/shared/main.php'; function uupListIds() { uupApiPrintBrand(); diff --git a/listlangs.php b/listlangs.php index 1c21678..d320a99 100644 --- a/listlangs.php +++ b/listlangs.php @@ -15,9 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. */ +require_once dirname(__FILE__).'/shared/main.php'; + function uupListLangs() { - require_once 'shared/main.php'; - require 'shared/packs.php'; + require dirname(__FILE__).'/shared/packs.php'; $langList = array(); $langListFancy = array(); diff --git a/shared/main.php b/shared/main.php index 10264ff..a39d5b3 100644 --- a/shared/main.php +++ b/shared/main.php @@ -16,7 +16,7 @@ limitations under the License. */ function uupApiVersion() { - return '0.3.0-alpha'; + return '0.4.0-alpha'; } function uupApiPrintBrand() { diff --git a/updateinfo.php b/updateinfo.php index 10666e8..d0495c6 100644 --- a/updateinfo.php +++ b/updateinfo.php @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -require_once 'shared/main.php'; +require_once dirname(__FILE__).'/shared/main.php'; function uupUpdateInfo($updateId, $onlyInfo = 0) { $info = @file_get_contents('fileinfo/'.$updateId.'.json');