예제 #1
0
 function get_package_parts($edition_num)
 {
     $edition_id = get_edition_id($edition_num);
     $zip_root_url = '../../' . get_package_path($edition_num) . $edition_id;
     $zip_root_path = get_package_dir($edition_num) . DIRECTORY_SEPARATOR . $edition_id;
     return array('html' => array('url' => $zip_root_url . '-html-0.zip', 'path' => $zip_root_path . '-html-0.zip'), 'assets' => array('url' => $zip_root_url . '-assets-0.zip', 'path' => $zip_root_path . '-assets-0.zip'));
 }
예제 #2
0
 function reply_package_xml($edition_num)
 {
     $edition_id = get_edition_id($edition_num);
     $now_atom = gmdate(DATE_ATOM, time());
     $now_822 = date(DATE_RFC822);
     $total_size = 0;
     $parts = get_package_parts($edition_num);
     foreach (array_keys($parts) as $part_name) {
         $part =& $parts[$part_name];
         $size = filesize($part['path']);
         $part['size'] = $size;
         $total_size += $size;
     }
     $content = '../../' . get_package_path($edition_num) . substr($_SERVER["SCRIPT_NAME"], 1) . "/edition/{$edition_num}/content.xml";
     $edition = pugpig_get_edition($edition_id);
     add_pugpig_headers($edition['ttl'], $edition['status']);
     header('Content-Type: application/xml');
     print "<package root=\"{$content}\" size=\"{$total_size}\">\n";
     print "<!-- Generated: {$now_822} -->\n";
     foreach (array_keys($parts) as $part_name) {
         $part =& $parts[$part_name];
         $size = $part['size'];
         $url = $part['url'];
         print "  <part name=\"{$part_name}\" src=\"{$url}\" size=\"{$size}\" modified=\"{$now_atom}\"/>\n";
     }
     print "</package>";
     exit;
 }
예제 #3
0
             $details = implode("<br />\n", claro_failure::get_last_failure());
             $dialogBox->error(Backlog_Reporter::report($summary, $details));
         }
     }
 } elseif (array_key_exists('packageCandidatePath', $_REQUEST)) {
     // If the target is a zip file, it must be unpack
     // If it's a unziped package, We copye the content
     if (is_package_file($_REQUEST['packageCandidatePath'])) {
         pushClaroMessage(__LINE__ . 'packageCandidatePath is a package', 'dbg');
         $modulePath = unzip_package($_REQUEST['packageCandidatePath']);
         pushClaroMessage(__LINE__ . '<pre>$modulePath =' . var_export($modulePath, 1) . '</pre>', 'dbg');
     } elseif (file_exists($_REQUEST['packageCandidatePath'])) {
         // COPY THE FILE TO WORK REPOSITORY
         pushClaroMessage(__LINE__ . 'packageCandidatePath is a path', 'dbg');
         claro_mkdir(get_package_path());
         $modulePath = create_unexisting_directory(get_package_path() . basename($_REQUEST['packageCandidatePath']));
         claro_mkdir($modulePath);
         pushClaroMessage(__LINE__ . 'create target' . $modulePath, 'dbg');
         if (claro_copy_file($_REQUEST['packageCandidatePath'], $modulePath . '/')) {
             $modulePath .= '/' . basename($_REQUEST['packageCandidatePath']);
             $moduleInstallable = true;
         } else {
             $dialogBox->error(get_lang('Module catching failed. Check your path'));
             $moduleInstallable = false;
         }
     }
 }
 pushClaroMessage(__LINE__ . '<pre>$modulePath =' . var_export($modulePath, 1) . '</pre>', 'dbg');
 // OK TO TRY TO INSTALL ?
 if ($moduleInstallable) {
     list($backlog, $module_id) = install_module($modulePath);
 function reply_package_zip($leaf)
 {
     if (preg_match('/((.*?)-.*\\.zip)/', $leaf, $matches) > 0) {
         $edition_id = $matches[2];
         $url = '../../' . get_package_path($edition_id) . $leaf;
         $base = get_current_url();
         $absolute_url = get_absolute_url($url, $base);
         header('Content-Type: application/octet-stream');
         header("Content-Disposition: attachment; filename={$leaf}");
         $ch = curl_init($absolute_url);
         if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
             curl_setopt($ch, CURLOPT_USERPWD, $_SERVER['PHP_AUTH_USER'] . ':' . $_SERVER['PHP_AUTH_PW']);
         }
         curl_exec($ch);
         curl_close($ch);
     }
 }
예제 #5
-1
<?php

// Package was hit directly (ie. request to /id/version). Currently we only
// expect these to be DELETE requests.
require __DIR__ . '/../inc/core.php';
if (request_method() !== 'DELETE') {
    api_error('405', 'Only DELETEs allowed here');
}
require_auth();
$id = $_GET['id'];
$version = $_GET['version'];
$path = get_package_path($id, $version);
if (file_exists($path)) {
    unlink($path);
}
DB::deleteVersion($id, $version);