diff --git a/website/index.php b/website/index.php index 2e3ee02d..559bd540 100644 --- a/website/index.php +++ b/website/index.php @@ -86,7 +86,9 @@ $pages = Array ( 'donate' => ' Donate', ); -$page = $_REQUEST['page']; +$page = 'home'; +if ( array_key_exists ( 'page', $_REQUEST ) ) + $page = $_REQUEST['page']; if ( ! array_key_exists ( $page, $pages ) ) $page = "home"; diff --git a/website/page/code/mobile-download.php b/website/page/code/mobile-download.php index 9a15e8de..5da156a6 100644 --- a/website/page/code/mobile-download.php +++ b/website/page/code/mobile-download.php @@ -17,15 +17,21 @@ function getMobileVersion ( $apkfile ) $archive = $apkinfo->getApkArchive(); - $iitc_file = "assets/total-conversion-build.user.js"; - if ( $archive->statName ( $iitc_file ) === FALSE ); - $iitc_file = "assets/iitc.js"; - $stream = $archive->getStream ( $iitc_file ); + $stream = $archive->getStream ( "assets/total-conversion-build.user.js" ); + if ( ! $stream ) + $stream = $archive->getStream ( "assets/iitc.js" ); - $header = loadUserScriptHeader ( $stream ); + if ( $stream ) + { + $header = loadUserScriptHeader ( $stream ); - $result['iitc_version'] = $header['@version']; + $result['iitc_version'] = $header['@version']; + } + else + { + $result['iitc_version'] = 'unknown'; + } return $result; } @@ -40,7 +46,7 @@ function iitcMobileDownload ( $apkfile ) # we need an absolute link for the QR Code # get the URL of this page itself - $pageurl = ($_SERVER['HTTPS'] ? "https" : "http")."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; + $pageurl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? "https" : "http")."://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; $apkurl = url_to_absolute ( $pageurl, $apkfile ); ?> diff --git a/website/page/code/userscript.php b/website/page/code/userscript.php index c229df76..845cc116 100644 --- a/website/page/code/userscript.php +++ b/website/page/code/userscript.php @@ -26,7 +26,7 @@ function loadUserScriptHeader($file) } } - fclose ( $f ); + fclose ( $file ); return $result; } diff --git a/website/page/test.php b/website/page/test.php index c91bdee0..db491779 100644 --- a/website/page/test.php +++ b/website/page/test.php @@ -19,10 +19,13 @@ include_once ( "code/desktop-download.php" ); $path = "test"; -if ( $_REQUEST['build'] == 'experimental' ) - $path = "experimental"; -if ( $_REQUEST['build'] == 'dev' ) - $path = "dev"; +if ( array_key_exists ( 'build', $_REQUEST ) ) +{ + if ( $_REQUEST['build'] == 'experimental' ) + $path = "experimental"; + if ( $_REQUEST['build'] == 'dev' ) + $path = "dev"; +} if ( $path != "test" ) print "
NOTE: A non-standard test build, $path, is currently selected. The notes may not apply! Return to the standard test build.
";