39 lines
1.3 KiB
PHP
39 lines
1.3 KiB
PHP
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="application/html; charset=utf-8"/>
|
||
<meta http-equiv="Copyright" content="Андрей Рейгант (HoldFast)"/>
|
||
<link rel="stylesheet" media="all" type="text/css" href="mbstyle/mbs.css"/>
|
||
<title>Сервис для работы с BAS файлами</title>
|
||
</head>
|
||
|
||
<body>
|
||
<h2>Сборщик мидлета</h2>
|
||
<?php
|
||
if (($_GET['midlet'] ?? '')!="yes") {
|
||
echo '<form action="?midlet=yes" method="post" enctype="multipart/form-data">
|
||
Выберите ваш bas файл:<br>
|
||
<input type="file" name="bas"><br>
|
||
<input type="submit" value="Собрать">
|
||
</form>';
|
||
} else {
|
||
if (is_uploaded_file($_FILES["bas"]["tmp_name"])) {
|
||
$name_bas = $_FILES["bas"]["tmp_name"];
|
||
$name = 'tmp/midlet'.rand(1000,99999).".jar";
|
||
|
||
$jar = new ZipArchive();
|
||
$jar->open($name, ZIPARCHIVE::CREATE);
|
||
$jar->addFile("midlet/META-INF/MANIFEST.MF" , "META-INF/MANIFEST.MF");
|
||
$jar->addFile($name_bas, "Autorun.bas");
|
||
$classes = ["Main", "a", "b", "c", "d", "e", "f", "g", "h", "s"];
|
||
foreach ($classes as $cl) {
|
||
$class = "$cl.class";
|
||
$jar->addFile("midlet/$class" , $class);
|
||
}
|
||
$jar->close();
|
||
echo 'Мидлет успешно собран!<br><a href="'.$name.'">Скачать</a>';
|
||
}
|
||
}
|
||
?>
|
||
</body>
|
||
</html>
|