Beispiel #1
0
    $control_tar_handle = fopen($control_tar_path, 'w');
    fputs($control_tar_handle, $control_c_raw_data[0][6]);
    fclose($control_tar_handle);
    $control_tar = new Tar();
    $new_tar = new Tar();
    $control_tar->load($control_tar_path);
    $control_array = $control_tar->contents();
    foreach ($control_array as $c_key => $c_value) {
        $alert .= "· " . sprintf(__('Processing file: %s'), htmlspecialchars($c_key)) . "<br />";
        if ($c_key != "control") {
            $new_tar->add_file($c_key, "", $control_array[$c_key]['data']);
        }
    }
    $new_path = "../tmp/" . $r_id . "/control.tar.gz";
    $new_tar->add_file("control", "", $f_Package);
    $new_tar->save($new_path);
}
$replace_result = $raw_data->replace($innername, $new_path);
$success = true;
if ($replace_result) {
    $alert .= "· " . __('Package has been successfully written!') . "<br />";
} else {
    $alert .= "· " . __('Warning: Writting to package failed!') . "<br />";
    $success = false;
}
$chk_success = true;
if ((int) DCRM_CHECK_METHOD != 0) {
    $new_md5 = md5_file($deb_path);
    if (!$new_md5) {
        $chk_success = false;
    } else {
Beispiel #2
0
             foreach ($new_filenames as $filename) {
                 $new_tar->add_file("/Applications/Cydia.app/Sections/" . $filename, 0755, file_get_contents($new_filepath));
             }
         }
     }
     $new_tar->save($new_path);
     $result = $raw_data->replace("data.tar.gz", $new_path);
     if (!$result) {
         $alert = __('Icon package template rewriting failed!');
         goto endlabel;
     } else {
         $control_path = "../tmp/" . $r_id . "/control.tar.gz";
         $control_tar = new Tar();
         $f_Package = "Package: " . (defined("AUTOFILL_PRE") ? AUTOFILL_PRE : '') . "sourceicon\nArchitecture: iphoneos-arm\nName: Source Icon\nVersion: 0.1-1\nAuthor: " . (defined("AUTOFILL_SEO") ? AUTOFILL_SEO . (defined("AUTOFILL_EMAIL") ? ' <' . AUTOFILL_EMAIL . '>' : '') : 'DCRM <*****@*****.**>') . "\nSponsor: " . (defined("AUTOFILL_MASTER") ? AUTOFILL_MASTER . (defined("AUTOFILL_EMAIL") ? ' <' . AUTOFILL_EMAIL . '>' : '') : 'i_82 <http://82flex.com>') . "\nMaintainer: " . (defined("AUTOFILL_MASTER") ? AUTOFILL_MASTER . (defined("AUTOFILL_EMAIL") ? ' <' . AUTOFILL_EMAIL . '>' : '') : 'i_82 <http://82flex.com>') . "\nDescription: Custom Empty Source Icon Package";
         $control_tar->add_file("control", "", $f_Package);
         $control_tar->save($control_path);
         $result = $raw_data->replace("control.tar.gz", $control_path);
         if (!$result) {
             $alert = __('Icon package template rewriting failed!');
             goto endlabel;
         } else {
             $result = rename($deb_path, "../upload/" . AUTOFILL_PRE . "sourceicon_" . time() . ".deb");
             if (!$result) {
                 $alert = __('Icon package template repositioning failed!');
                 goto endlabel;
             }
             header("Location: manage.php");
             exit;
         }
     }
 } else {
Beispiel #3
0
    }
    /* nonzero indicates error */
    public function save_one($f, $name, $file)
    {
        $file['size'] = strlen($file['data']);
        $file['name'] = $name;
        $hdr_data = $this->header_pack($file);
        if ($hdr_data === FALSE) {
            return -1;
        }
        unset($file['size']);
        /* size is implicit in data */
        unset($file['name']);
        /* name is array key */
        $f->record_save($hdr_data);
        $f->record_save($file['data']);
        return 0;
    }
}
if (isset($argv)) {
    $tar = new Tar();
    if (count($argv) > 1) {
        $tar->load($argv[1]);
    } else {
        $tar->load("/dev/stdin");
    }
    foreach ($tar->files as $name => $file) {
        echo $name . "\n";
    }
    $tar->save("somefile.tar.gz", ".gz");
}