if ($icon_assoc['Icon'] != "") { // Compatible with earlier Cydia version and special situations $new_filename = $new_filenames[] = str_replace(" ", "_", $icon_assoc['Name']) . '.png'; if (substr($new_filename, 0, 1) == '[' && substr($new_filename, -5, -4) == ']') { $new_filenames[] = substr($new_filename, 1, -5) . '.png'; } $new_filepath = "../tmp/" . $r_id . "/Applications/Cydia.app/Sections/" . $new_filename; copy("../icons/" . $icon_assoc['Icon'], $new_filepath); 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");
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 { $md5_query = DB::query("UPDATE `" . DCRM_CON_PREFIX . "Packages` SET `MD5sum` = '" . $new_md5 . "' WHERE `ID` = '" . (string) $request_id . "'"); }