Ejemplo n.º 1
0
         $files[] = $element;
     }
 }
 if (empty($files)) {
     echo "Y U NO UPLOAD FILES ?";
 } else {
     $package_list = "";
     $error_log = "";
     foreach ($files as $file) {
         $package = "";
         if (!is_dir("tmp")) {
             mkdir("tmp");
         } elseif (file_exists("tmp/control.tar.gz")) {
             unlink("tmp/control.tar.gz");
         }
         $debfile = new phpAr("deb/" . $file);
         $control_file = $debfile->getfile('control.tar.gz');
         if ($control_file != false) {
             $control_handle = fopen("tmp/control.tar.gz", "w");
             fputs($control_handle, $control_file[0][6]);
             fclose($control_handle);
             $filexec = gzfile("tmp/control.tar.gz");
             foreach ($filexec as $line) {
                 $line = trim($line);
                 if (preg_match("#^Package|Source|Version|Priority|Section|Essential|Maintainer|Pre-Depends|Depends|Recommends|Suggests|Conflicts|Provides|Replaces|Enhances|Architecture|Filename|Size|Installed-Size|Description|Origin|Bugs|Name|Author|Homepage|Website|Depiction|Icon#", $line)) {
                     $package[trim(preg_replace("#^(.+): (.+)#", "\$1", $line))] = trim(preg_replace("#^(.+): (.+)#", "\$2", $line));
                 }
             }
             if (!empty($package['MD5Sum']) and $package['MD5Sum'] != md5_file("deb/" . $file) or !empty($package['Size']) and $package['Size'] != filesize("deb/" . $file)) {
                 $error_log .= str_replace("//PACKAGE//", $file, $lang_build['corrupted_informations'][DCRM_LANG]) . "\n";
             } else {
Ejemplo n.º 2
0
     $result = mkdir("../tmp/");
 }
 if (!is_dir("../tmp/" . $r_id)) {
     $result = mkdir("../tmp/" . $r_id);
     if (!$result) {
         $alert = __('Cannot create temporary directory, please check the file permissions!');
         goto endlabel;
     }
 }
 $deb_path = "../tmp/" . $r_id . "/icon_" . time() . ".deb";
 $result = copy(CONF_PATH . 'empty_icon.deb', $deb_path);
 if (!$result) {
     $alert = __('Icon package template copy failed, please check the file permissions!');
     goto endlabel;
 }
 $raw_data = new phpAr($deb_path);
 $new_tar = new Tar();
 $new_path = "../tmp/" . $r_id . "/data.tar.gz";
 $icon_query = DB::fetch_all("SELECT * FROM `" . DCRM_CON_PREFIX . "Sections`");
 mkdir("../tmp/" . $r_id . "/Applications");
 mkdir("../tmp/" . $r_id . "/Applications/Cydia.app");
 mkdir("../tmp/" . $r_id . "/Applications/Cydia.app/Sections");
 foreach ($icon_query as $icon_assoc) {
     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);
Ejemplo n.º 3
0
    goto endlabel;
}
$file_md5 = md5_file($r_path);
$md5_query = DB::query("SELECT `MD5sum` FROM `" . DCRM_CON_PREFIX . "Packages` WHERE `MD5sum` = '" . $file_md5 . "'");
if ($md5_query == false) {
    $alert = sprintf(__('Invalid request: %s'), DB::error());
    $success = false;
    goto endlabel;
}
$md5_row = mysql_fetch_row($md5_query);
if ($md5_row != false) {
    $alert = sprintf(__('File already exists: %s'), $file_md5);
    $success = false;
    goto endlabel;
}
$raw_data = new phpAr($r_path);
$filename_array = $raw_data->listfiles();
foreach ($filename_array as $filename) {
    if (is_int(stripos($filename, 'control.tar.gz'))) {
        $control_c_raw_data = $raw_data->getfile($filename);
        goto nextstep;
    }
}
nextstep:
if (is_int(stripos($control_c_raw_data[0][0], 'control.tar.gz'))) {
    if (!is_dir("../tmp/")) {
        mkdir("../tmp/");
    }
    if (!is_dir("../tmp/" . $r_id)) {
        mkdir("../tmp/" . $r_id);
    }
Ejemplo n.º 4
0
}
unset($m_array['Filename']);
$f_Package = "";
foreach ($m_array as $m_key => $m_value) {
    if (strlen($m_value) > 0 and $m_value != NULL) {
        $f_Package .= $m_key . ": " . trim(str_replace("\n", "\n ", $m_value)) . "\n";
    }
}
$r_id = randstr(40);
if (!is_dir("../tmp/")) {
    mkdir("../tmp/");
}
if (!is_dir("../tmp/" . $r_id)) {
    mkdir("../tmp/" . $r_id);
}
$raw_data = new phpAr($deb_path);
$filename_array = $raw_data->listfiles();
foreach ($filename_array as $filename) {
    if (is_int(stripos($filename, 'control.tar.gz'))) {
        $control_c_raw_data = $raw_data->getfile($filename);
        $innername = $filename;
        goto nextstep;
    }
}
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();