diff --git a/website/page/code/mobile-download.php b/website/page/code/mobile-download.php new file mode 100644 index 00000000..24393cb8 --- /dev/null +++ b/website/page/code/mobile-download.php @@ -0,0 +1,68 @@ +getManifest(); + + $result['apk_version'] = $manifest->getVersionName(); + + + $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 ); + + $header = loadUserScriptHeader ( $stream ); + + $result['iitc_version'] = $header['@version']; + + return $result; +} + +function iitcMobileDownload ( $apkfile ) +{ + + $version = getMobileVersion ( $apkfile ); + + $apk_version = $version['apk_version']; + $iitc_version = preg_replace ( '/^(\d+\.\d+\.\d+)\.(\d{8}\.\d{6})/', '\1.\2', $version['iitc_version'] ); + + # 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']; + $apkurl = url_to_absolute ( $pageurl, $apkfile ); +?> + + +
+IITC Mobile version $apk_version, with IITC version $iitc_version
\n"; - - print "\n"; - + iitcMobileDownload ( $apkfile ); } else { diff --git a/website/page/test.php b/website/page/test.php index 7126f67f..e16a0f3b 100644 --- a/website/page/test.php +++ b/website/page/test.php @@ -60,27 +60,21 @@ iitcDesktopPluginDownloadTable ( $path ); .\2', $version['iitc_version'] ); - - print "IITC Mobile version $apk_version, with IITC version $iitc_version
\n"; - - print "Download\n"; - + iitcMobileDownload ( $apkfile ); } else { print "