Example #1
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
$folder = 'files';
if (!empty($_FILES)) {
    $tempFile = $_FILES['file']['tmp_name'];
    if (empty($tempFile)) {
        die('error uploading file - error code: ' . $_FILES['file']['error']);
    }
    $uploadId = md5_file($tempFile);
    $targetPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $uploadId . DIRECTORY_SEPARATOR;
    if (file_exists($targetPath)) {
        die('file already uploaded!');
    }
    mkdir($targetPath);
    $targetFile = $targetPath . $_FILES['file']['name'];
    if (!move_uploaded_file($tempFile, $targetFile)) {
        die('error uploading file');
    }
    require 'php/ipaTools.php';
    $ipa = new IpaTools($targetFile);
    $response = json_encode(array('devices' => $ipa->getDevices(), 'url' => $ipa->applink, 'id' => $uploadId, 'filename' => $_FILES['file']['name']));
    header('Content-type: application/json');
    echo $response;
}
Example #2
0
<?php 
if (!empty($_GET['p'])) {
    $ts = $_GET['p'];
    $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $ts . DIRECTORY_SEPARATOR;
    $files = glob($path . '*.ipa');
    if (!empty($files) && count($files) == 1) {
        $ipaInfo = pathinfo($files[0]);
        $ipa['file'] = $ipaInfo['basename'];
        //$ipa['deleteUrl'] = 'delete.php?id=' . $ts;
        //$ipa['created'] = date('j M Y G:i:s', $ts);
        $ipa['currentUrl'] = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}/{$_SERVER['REQUEST_URI']}";
        $ipa['qr'] = 'https://chart.googleapis.com/chart?chs=140x140&cht=qr&chld=H|1&chl=' . $ipa['currentUrl'];
        require 'php' . DIRECTORY_SEPARATOR . 'ipaTools.php';
        $targetPath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . $ts . DIRECTORY_SEPARATOR;
        $targetFile = $targetPath . $ipa['file'];
        $ipaTools = new IpaTools($targetFile, true);
        $ipa['devices'] = $ipaTools->getDevices();
        $ipa['installUrl'] = $ipaTools->applink;
    } else {
        die('Package file not found');
    }
} else {
    die('APP Package hash missing');
}
?>

<html>
<head>
    <title>BEdita – IPA Ad Hoc Distribution</title>
    <meta charset="utf-8">
    <link href="css/dropzone.css" type="text/css" rel="stylesheet" />