Esempio n. 1
0
 $v->dt = dater();
 $v->downloads = 0;
 $v->updates = 0;
 $tmpfile = "";
 if ($v->url) {
     $tmpfile = tempnam(sys_get_temp_dir(), 'sparkle_stdin');
     $data = get_data_from_url($v->url);
     if (!$data) {
         die("The file at <a href='{$v->url}'>{$v->url}</a> does not exist or is empty!");
     }
     file_put_contents($tmpfile, $data);
 } else {
     $tmpfile = $_FILES['file']['tmp_name'];
 }
 $v->filesize = filesize($tmpfile);
 $v->signature = sign_file($tmpfile, $app->sparkle_pkey);
 if (!$v->url) {
     $object = strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $app->name)) . "_" . $v->version_number . "." . substr($_FILES['file']['name'], -3);
     if ($app->s3bucket && $app->s3path) {
         $v->url = slash($app->s3path) . $object;
         $info = parse_url($app->s3path);
         $object = slash($info['path']) . $object;
         chmod($tmpfile, 0755);
         $s3 = new S3($app->s3key, $app->s3pkey);
         $s3->putObject($app->s3bucket, $object, $tmpfile, true);
     } else {
         die("Configure your Amazon S3 account or modify version-new.php file.");
         /*
         $v->url = '/Users/dirk/work/wordpress/shine/' . $object;
         copy($_FILES['file']['tmp_name'], '/Users/dirk/work/wordpress/shine/' . $object);
         */
Esempio n. 2
0
function test_signing($filename, $outfile)
{
    $data = read_file($filename);
    $json = json_decode($data, true);
    $signData = format_data_to_sign($json);
    $signature = sign_file($signData);
    $json['digital_signature'] = array('key_location' => array('http://12.109.40.15/resource_data/key/key.asc'), 'signature' => $signature, 'key_owner' => '*****@*****.**', 'signing_method' => 'LR-PGP.1.0');
    $jsonString = json_encode($json);
    write_file($outfile, $jsonString);
}
Esempio n. 3
0
    redirect('index.php');
}
if (isset($_POST['btnCreateVersion'])) {
    $Error->blank($_POST['version_number'], 'Version Number');
    $Error->blank($_POST['human_version'], 'Human Readable Version Number');
    $Error->upload($_FILES['file'], 'file');
    if ($Error->ok()) {
        $v = new Version();
        $v->app_id = $app->id;
        $v->version_number = $_POST['version_number'];
        $v->human_version = $_POST['human_version'];
        $v->release_notes = $_POST['release_notes'];
        $v->dt = dater();
        $v->downloads = 0;
        $v->filesize = filesize($_FILES['file']['tmp_name']);
        $v->signature = sign_file($_FILES['file']['tmp_name'], $app->sparkle_pkey);
        $object = strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $app->name)) . "_" . $v->version_number . "." . substr($_FILES['file']['name'], -3);
        $v->url = slash($app->s3path) . $object;
        $info = parse_url($app->s3path);
        $object = slash($info['path']) . $object;
        chmod($_FILES['file']['tmp_name'], 0755);
        $s3 = new S3($app->s3key, $app->s3pkey);
        $s3->putObject($app->s3bucket, $object, $_FILES['file']['tmp_name'], true);
        $v->insert();
        redirect('versions.php?id=' . $app->id);
    } else {
        $version_number = $_POST['version_number'];
        $human_version = $_POST['human_version'];
        $release_notes = $_POST['release_notes'];
    }
} else {
Esempio n. 4
0
 }
 // END adib 7-Apr-2010 10:57
 if ($Error->ok()) {
     $v = new Version();
     $v->app_id = $app->id;
     $v->version_number = $_POST['version_number'];
     $v->human_version = $_POST['human_version'];
     $v->release_notes = $_POST['release_notes'];
     $v->dt = dater();
     $v->downloads = 0;
     // BEGIN adib 7-Apr-2010 10:58
     //$v->filesize       = filesize($_FILES['file']['tmp_name']);
     //$v->signature      = sign_file($_FILES['file']['tmp_name'], $app->sparkle_pkey);
     //$object = strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $app->name)) . "_" . $v->version_number . "." . substr($_FILES['file']['name'], -3);
     $v->filesize = filesize($uploadedFile['tmp_name']);
     $v->signature = sign_file($uploadedFile['tmp_name'], $app->sparkle_pkey);
     $object = strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $app->name)) . "_" . $v->version_number . "." . substr($uploadedFile['name'], -3);
     // END adib 7-Apr-2010 10:58
     // BEGIN adib 7-Apr-2010 12:36
     // upload to S3 only if its configured.
     if (!empty($app->s3path)) {
         // END adib 7-Apr-2010 12:36
         $v->url = slash($app->s3path) . $object;
         $info = parse_url($app->s3path);
         $object = slash($info['path']) . $object;
         // BEGIN adib 7-Apr-2010 10:59
         //chmod($_FILES['file']['tmp_name'], 0755);
         if (is_uploaded_file($uploadedFile['tmp_name'])) {
             chmod($uploadedFile['tmp_name'], 0755);
         }
         // END adib 7-Apr-2010 10:59