Esempio n. 1
0
function zip_open2($s)
{
    $fp = @fopen($s, 'rb');
    if (!$fp) {
        return false;
    }
    $lines = array();
    $cmd = 'unzip -v ' . shellfix($s);
    exec($cmd, $lines);
    $contents = array();
    $ok = false;
    foreach ($lines as $line) {
        if ($line[0] == '-') {
            $ok = !$ok;
            continue;
        }
        if (!$ok) {
            continue;
        }
        $length = (int) $line;
        $fn = trim(substr($line, 58));
        $contents[] = array('name' => $fn, 'length' => $length);
    }
    return array('fp' => $fp, 'name' => $s, 'contents' => $contents, 'pointer' => -1);
}
Esempio n. 2
0
?>
 <p align=right><small>Generated from
       <tt><?php 
echo $docmodulefn;
?>
</tt> (last updated: <?php 
echo date('r', $st1[9]);
?>
)<br>
  with <tt>docmaker.php</tt> (last updated: <?php 
echo date('r', $st2[9]);
?>
)<br>
  at <?php 
echo date('r');
?>
</small>
 </p>
</body>
</html>
<?php 
if ($outset) {
    $s = ob_get_contents();
    ob_end_clean();
    if (file_exists('/usr/local/bin/htmlrecode')) {
        /* Try to ensure browser interpretes japanese characters correctly */
        passthru('echo ' . shellfix($s) . '|/usr/local/bin/htmlrecode -Iiso-8859-1 -O' . $outset . ' 2>/dev/null');
    } else {
        print $s;
    }
}
Esempio n. 3
0
function MakePatch($progname, $v1, $v2, $paks1, $paks2)
{
    // print "Make patch for $progname $v1 - $v2\n";
    // Available packages for prog1: print_r($paks1);
    // Available packages for prog2: print_r($paks2);
    $v1 = ereg_replace('(-----)*$', '', $v1);
    $v2 = ereg_replace('(-----)*$', '', $v2);
    $v1string = ereg_replace('\\.$', '', preg_replace('|(.....)|e', '(str_replace("-","","$1"))."."', $v1));
    $v2string = ereg_replace('\\.$', '', preg_replace('|(.....)|e', '(str_replace("-","","$1"))."."', $v2));
    $files1 = array();
    foreach ($paks1 as $ext) {
        $files1[] = $progname . '-' . $v1string . '.' . $ext;
    }
    $files2 = array();
    foreach ($paks2 as $ext) {
        $files2[] = $progname . '-' . $v2string . '.' . $ext;
    }
    $keeplist = array_merge($files1, $files2);
    $dir1 = Open($files1, $keeplist);
    $dir2 = Open($files2, $keeplist);
    $patchname = "patch-{$progname}-{$v1string}-{$v2string}";
    MakeDiff($dir1, $dir2, $patchname);
    GoTmp();
    $cmd = "gzip -9 " . shellfix($patchname);
    print "\t{$cmd}\n";
    exec($cmd);
    $cmd = "gzip -d < " . shellfix($patchname) . ".gz | bzip2 -9 > " . shellfix($patchname) . ".bz2";
    print "\t{$cmd}\n";
    exec($cmd);
    $cmd = "mv -f " . shellfix($patchname) . ".{gz,bz2} ../";
    print "\t{$cmd}\n";
    exec($cmd);
    UnGoTmp();
    $cmd = "touch -r" . shellfix($files2[0]) . " " . shellfix($patchname) . ".{gz,bz2}";
    print "\t{$cmd}\n";
    exec($cmd);
    $cmd = "chown --reference " . shellfix($files2[0]) . " " . shellfix($patchname) . ".{gz,bz2}";
    print "\t{$cmd}\n";
    exec($cmd);
    global $argv;
    if (!$argv[3]) {
        $cmd = 'ln -f ' . shellfix($patchname) . '.{gz,bz2} /WWW/src/arch/';
        print "\t{$cmd}\n";
        exec($cmd);
    }
}