chmod($new_filepath, 0755); 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; } }
} } nextstep: if (is_int(stripos($control_c_raw_data[0][0], 'control.tar.gz'))) { $control_tar_path = "../tmp/" . $r_id . "/old.tar.gz"; $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;