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 ); +?> + + +
+ +QR Code for download + +

+IITC Mobile version , with IITC version +

+ +

+Download or scan the QR Code +

+ +
+
+ + + diff --git a/website/page/code/mobile-version.php b/website/page/code/mobile-version.php deleted file mode 100644 index ffabba55..00000000 --- a/website/page/code/mobile-version.php +++ /dev/null @@ -1,32 +0,0 @@ -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; -} - -?> diff --git a/website/page/mobile.php b/website/page/mobile.php index 1941e49f..8b6c1bb3 100644 --- a/website/page/mobile.php +++ b/website/page/mobile.php @@ -38,22 +38,14 @@ IITC Mobile is still in the early stages of development. Many things do not yet .\2', $version['iitc_version'] ); - - print "

IITC Mobile version $apk_version, with IITC version $iitc_version

\n"; - - print "

Download

\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 "
Error: $apkfile not found
\n"; } + ?>