示例#1
0
function uncompress($path = null)
{
    ob_start();
    readgzfile($path);
    $result = ob_get_clean();
    return $result;
}
示例#2
0
 public function dcrec($gameid, $filename = false)
 {
     $game = Game::getgame($gameid);
     $file = $game->get_dcrec();
     if ($filename && $filename !== basename($file)) {
         app()->show_404();
     }
     $gz = false;
     if (!is_readable($file)) {
         $file = $file . ".gz";
         if (!is_readable($file)) {
             header($_SERVER['SERVER_PROTOCOL'] . ' 403');
             die("access denied");
         }
         $gz = true;
     }
     $patt = '/\\.gz$/';
     $base = basename($file);
     //$gz = preg_match($patt, $file);
     $name = $gz ? preg_replace($patt, '', $base) : $base;
     header('Content-Description: Dedcon Recording');
     header('Content-Type: application/octet-stream');
     header('Content-Disposition: attachment; filename="' . $name . '"');
     header('Content-Transfer-Encoding: binary');
     header('Expires: 0');
     header('Cache-Control: must-revalidate');
     if (!$gz) {
         header('Content-Length: ' . filesize($file));
     }
     ob_clean();
     flush();
     readgzfile($file);
     exit;
 }
示例#3
0
 public static function gzdecode($data)
 {
     $g = tempnam('/tmp', 'ff');
     @file_put_contents($g, $data);
     ob_start();
     readgzfile($g);
     $d = ob_get_clean();
     return $d;
 }
示例#4
0
文件: Gd.php 项目: slkxmail/App
function gzdecode($data)
{
    $g = tempnam(APPLICATION_PATH . '/../../data/temp', 'gzip');
    @file_put_contents($g, $data);
    ob_start();
    readgzfile($g);
    $d = ob_get_clean();
    unlink($g);
    return $d;
}
示例#5
0
 /**
  * Uncompress data from package
  * @param string $path
  */
 public function uncompress($path = null, $callback = null)
 {
     ob_start();
     readgzfile($path);
     $result = ob_get_clean();
     if ($callback instanceof \Closure) {
         return call_user_func_array($callback, array($result));
     }
     return $result;
 }
示例#6
0
function my_gzdecode($data)
{
    $g = tempnam('', 'gztmp');
    @file_put_contents($g, $data);
    ob_start();
    readgzfile($g);
    $d = ob_get_clean();
    unlink($g);
    return $d;
}
示例#7
0
文件: system.php 项目: Git-Host/proxy
 function gzdecode($data)
 {
     $file = tempnam("/tmp", "gzip");
     @file_put_contents($file, $data);
     ob_start();
     readgzfile($file);
     $data = ob_get_clean();
     unlink($file);
     return $data;
 }
示例#8
0
function downloadFile($fullPath, $filename)
{
    // Must be fresh start
    if (headers_sent()) {
        die('Headers Sent');
    }
    // Required for some browsers
    if (ini_get('zlib.output_compression')) {
        ini_set('zlib.output_compression', 'Off');
    }
    // echo `ls -la /`;
    // echo `ls -la /home/`;
    // echo `ls -la /home/data2/`;
    // echo `ls -la /home/data2/secure-upload/`;
    // echo `ls -la /home/data2/secure-upload/isolates/`;
    // echo `ls -la /home/data2/secure-upload/isolates/*`;
    // echo `ls -la /home/data2/secure-upload/isolates/*/0/`;
    // echo `ls -la $fullPath`;
    // echo $fullPath;
    // File Exists?
    if (file_exists($fullPath)) {
        //  $pos = strrpos($filename, '.gz');
        //  if($pos !== false){
        // 	$filename = substr($filename, 0, $pos);
        //  };
        //header("Pragma: public"); // required
        //header("Expires: 0");
        //header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        //header("Cache-Control: private",false); // required for certain browsers
        //header("Content-Type: application/force-download");
        //header("Content-Disposition: attachment; filename=".$filename.";" );
        //header("Content-Transfer-Encoding: binary");
        //header("Content-Length: ".filesize($fullPath));
        //ob_clean();
        //flush();
        //readfile( $fullPath );
        header("Content-Description: File Transfer");
        header("Content-Disposition: attachment; filename={$filename};");
        header("Content-Type: application/force-download");
        header("Content-Transfer-Encoding: binary");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Cache-Control: private", false);
        // required for certain browsers
        header("Expires: 0");
        header("Pragma: public");
        // required
        #header("Content-Length: ".filesize($fullPath));
        header("X-Sendfile: {$fullPath}");
        ob_clean();
        flush();
        readgzfile($fullPath);
    } else {
        die('File Not Found');
    }
}
示例#9
0
 private static function gzdecode($file)
 {
     if (!is_file($file)) {
         return '';
     }
     if (function_exists('gzdecode')) {
         return gzdecode($file);
     }
     ob_start();
     readgzfile($file);
     $content = ob_get_clean();
     return $content;
 }
 public function testDumper()
 {
     $dumper = new GzFileDumper($this->file);
     $dumper->dump('joe');
     $dumper->dump('-hell yeah!');
     $this->assertTrue(file_exists($this->file));
     unset($dumper);
     // force the dumper to close the file
     // readgzfile reads the content of the file and also prints it...
     ob_start();
     readgzfile($this->file);
     $content = ob_get_contents();
     ob_clean();
     $this->assertEquals('joe-hell yeah!', $content);
     $this->assertNotEquals('joe-hell yeah!', file_get_contents($this->file), 'The file\'s content is compressed');
 }
示例#11
0
function test_readgzfile()
{
    global $scriptFile, $secondFile, $firstFile, $filename;
    // create a file in the middle directory
    $h = gzopen($secondFile, "w");
    gzwrite($h, "This is a file in dir2");
    gzclose($h);
    // should read dir2 file
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    //create a file in dir1
    $h = gzopen($firstFile, "w");
    gzwrite($h, "This is a file in dir1");
    gzclose($h);
    //should now read dir1 file
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    // create a file in working directory
    $h = gzopen($filename, "w");
    gzwrite($h, "This is a file in working dir");
    gzclose($h);
    //should still read dir1 file
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    unlink($firstFile);
    unlink($secondFile);
    //should read the file in working dir
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    // create a file in the script directory
    $h = gzopen($scriptFile, "w");
    gzwrite($h, "This is a file in script dir");
    gzclose($h);
    //should read the file in script dir
    echo "file content:";
    readgzfile($filename, true);
    echo "\n";
    //cleanup
    unlink($filename);
    unlink($scriptFile);
}
示例#12
0
 /**
  * gzdecode function.
  * 
  * @param mixed $data
  * @return mixed
  */
 protected function gzdecode($data)
 {
     do {
         $tempName = uniqid('temp ');
     } while (file_exists($tempName));
     if (file_put_contents($tempName, $data)) {
         try {
             ob_start();
             @readgzfile($tempName);
             $uncompressed = ob_get_clean();
         } catch (Exception $e) {
             $ex = $e;
         }
         unlink($tempName);
         if (isset($ex)) {
             throw $ex;
         }
         return $uncompressed;
     }
 }
示例#13
0
 /**
  * Récupération du texte à indexer dans l'archive
  */
 function get_text($filename)
 {
     $this->zip = zip_open($filename);
     if ($this->zip) {
         while ($zip_entry = zip_read($this->zip)) {
             $t = array();
             $tab = explode("/", dirname(zip_entry_name($zip_entry)));
             $type_images_doc_num = $tab[count($tab) - 1];
             if ($type_images_doc_num == "X") {
                 if (zip_entry_open($this->zip, $zip_entry, "r")) {
                     $xmlGz = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                     $tmpfile = tempnam("/tmp", "ocr");
                     @file_put_contents($tmpfile, $xmlGz);
                     ob_start();
                     readgzfile($tmpfile);
                     $xml = ob_get_clean();
                     $xml_dom = new xml_dom($xml, "iso-8859-1");
                     $textBlocs = @$xml_dom->get_nodes("alto/Layout/Page/PrintSpace/TextBlock");
                     if ($textBlocs) {
                         foreach ($textBlocs as $textBloc) {
                             $textlines = $xml_dom->get_nodes("TextLine", $textBloc);
                             foreach ($textlines as $textline) {
                                 $strings = $xml_dom->get_nodes("String", $textline);
                                 foreach ($strings as $string) {
                                     $attrs = $xml_dom->get_attributes($string);
                                     foreach ($attrs as $attr => $value) {
                                         if ($attr == 'CONTENT') {
                                             $texte_final .= " " . $value;
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $texte_final;
 }
示例#14
0
 /**
  * Extract gz file
  */
 private function _extract_gz($source)
 {
     $cache_path = $this->_cache_path();
     ob_start();
     readgzfile($cache_path . $source);
     $file_contents = ob_get_contents();
     ob_end_clean();
     $outname = str_replace('.gz', '', $source);
     file_put_contents($cache_path . $outname, $file_contents);
     @chmod($cache_path . $outname, FILE_WRITE_MODE);
 }
示例#15
0
<?php

readgzfile("mmog.sql.gz");
示例#16
0
 /**
  */
 public function set_cache($out_type, $md5, $data = [])
 {
     if (!$this->USE_CACHE) {
         return false;
     }
     $cache_path = $this->_cache_path($out_type, $md5, $data);
     $content = $data['content'];
     $content_type = $data['content_type'];
     $content_url = '';
     if ($content_type === 'url') {
         $content_url = $content;
         $content = $this->_url_get_contents($content_url);
     } elseif ($content_type === 'file') {
         $content = file_get_contents($content);
     }
     if (!strlen($content)) {
         return false;
     }
     // Content is same, no need to overwrite it
     $cache_existed = file_exists($cache_path);
     if ($cache_existed && file_get_contents($cache_path) === $content) {
         is_writable($cache_path) && touch($cache_path);
         return $cache_path;
     }
     file_put_contents($cache_path, $content);
     // Decode gzip content to not confuse browser and web server, as gzdecode($content) is PHP 5.4+ only
     // gzip file beginnning: \x1F\x8B
     if (bin2hex(substr($content, 0, 2)) === '1f8b') {
         ob_start();
         readgzfile($cache_path);
         $content = ob_get_clean();
         file_put_contents($cache_path, $content);
     }
     if ($out_type === 'css' && in_array($content_type, ['url', 'inline', 'file'])) {
         $content_before = $content;
         $content = $this->_css_urls_rewrite_and_save($content, $content_url, $cache_path, $content_type, $data['content']);
         if ($content_before !== $content) {
             file_put_contents($cache_path, $content);
         }
         unset($content_before);
     }
     if ($out_type === 'js' && $content_type === 'url') {
         $this->_js_map_save($content, $content_url, $cache_path);
     }
     // Content is same, no need to overwrite info about it
     // This is not a mistake to do this check again, after url rewrite content can still be same
     if ($cache_existed && file_get_contents($cache_path) === $content) {
         return $cache_path;
     }
     $this->_write_cache_info($cache_path, $content_url, $content);
     return $cache_path;
 }
示例#17
0
 /**
 		Decode gzip-compressed string
 		@param $data string
 		@param $len int
 	**/
 function gzdecode($str, $len = 0)
 {
     $fw = Base::instance();
     if (!is_dir($tmp = $fw->get('TEMP'))) {
         mkdir($tmp, Base::MODE, TRUE);
     }
     file_put_contents($file = $tmp . '/' . $fw->hash($fw->get('ROOT') . $fw->get('BASE')) . '.' . $fw->hash(uniqid()) . '.gz', $str, LOCK_EX);
     ob_start();
     readgzfile($file);
     $out = ob_get_clean();
     @unlink($file);
     return $out;
 }
示例#18
0
 * @package PhpMyAdmin
 */
/**
 * Gets core libraries and defines some variables
 */
require 'libraries/common.inc.php';
$filename = CHANGELOG_FILE;
/**
 * Read changelog.
 */
// Check if the file is available, some distributions remove these.
if (is_readable($filename)) {
    // Test if the if is in a compressed format
    if (substr($filename, -3) == '.gz') {
        ob_start();
        readgzfile($filename);
        $changelog = ob_get_contents();
        ob_end_clean();
    } else {
        $changelog = file_get_contents($filename);
    }
} else {
    printf(__('The %s file is not available on this system, please visit www.phpmyadmin.net for more information.'), $filename);
    exit;
}
/**
 * Whole changelog in variable.
 */
$changelog = htmlspecialchars($changelog);
$replaces = array('@(http://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@' => '<a href="\\1">\\1</a>', '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*)@users.sourceforge.net&gt;/i' => '\\1 <a href="https://sourceforge.net/users/\\3/">\\2</a>', '/thanks to ([^\\(\\r\\n]+) \\(([-\\w]+)\\)/i' => 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>', '/thanks to ([^\\(\\r\\n]+) -\\s+([-\\w]+)/i' => 'thanks to <a href="https://sourceforge.net/users/\\2/">\\1</a>', '/([0-9]{4}-[0-9]{2}-[0-9]{2}) (.+[^ ]) +&lt;(.*@.*)&gt;/i' => '\\1 <a href="mailto:\\3">\\2</a>', '/patch\\s*#?([0-9]{6,})/i' => '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">patch #\\1</a>', '/(?:rfe|feature)\\s*#?([0-9]{6,})/i' => '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">RFE #\\1</a>', '/(\\s+)([\\/a-z_0-9\\.]+\\.(?:php3?|html|pl|js|sh))/i' => '\\1<a href="https://github.com/phpmyadmin/phpmyadmin/commits/HEAD/\\2">\\2</a>', '/FAQ ([0-9]+)\\.([0-9a-z]+)/i' => '<a href="http://localhost/phpMyAdmin/Documentation.html#faq\\1_\\2">FAQ \\1.\\2</a>', '/bug\\s*#?([0-9]{6,})/i' => '<a href="https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>', '/(?<!bug|RFE|patch) #?([0-9]{6,})/i' => ' <a href="https://sourceforge.net/support/tracker.php?aid=\\1">bug #\\1</a>', '/((CAN|CVE)-[0-9]+-[0-9]+)/' => '<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=\\1">\\1</a>', '/(PMASA-[0-9]+-[0-9]+)/' => '<a href="http://www.phpmyadmin.net/home_page/security/\\1.php">\\1</a>', '/([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.0 (\\([0-9-]+\\))/' => '<a name="\\1_\\2_\\3"></a><a href="https://github.com/phpmyadmin/phpmyadmin/commits/RELEASE_\\1_\\2_\\3">\\1.\\2.\\3.0 \\4</a>', '/([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([1-9][0-9]*) (\\([0-9-]+\\))/' => '<a name="\\1_\\2_\\3_\\4"></a><a href="https://github.com/phpmyadmin/phpmyadmin/commits/RELEASE_\\1_\\2_\\3_\\4">\\1.\\2.\\3.\\4 \\5</a>', '/(    ### )(.*)/' => '\\1<b>\\2</b>');
header('Content-type: text/html; charset=utf-8');
示例#19
0
 if ($reldata) {
     $rel->updateGrab($_GET["id"]);
     $page->users->addDownloadRequest($uid, $reldata['id']);
     $page->users->incrementGrabs($uid);
     if (isset($_GET["del"]) && $_GET["del"] == 1) {
         $page->users->delCartByUserAndRelease($_GET["id"], $uid);
     }
 } else {
     header("X-DNZB-RCode: 404");
     header("X-DNZB-RText: Release not found!");
     $page->show404();
 }
 // Start reading output buffer.
 ob_start();
 // De-gzip the NZB and store it in the output buffer.
 readgzfile($nzbpath);
 // Set the NZB file name.
 header("Content-Disposition: attachment; filename=" . str_replace([',', ' '], '_', $reldata["searchname"]) . ".nzb");
 // Get the size of the NZB file.
 header("Content-Length: " . ob_get_length());
 header("Content-Type: application/x-nzb");
 header("Expires: " . date('r', time() + 31536000));
 // Set X-DNZB header data.
 header("X-DNZB-Failure: " . $page->serverurl . 'failed/' . '?guid=' . $_GET['id'] . '&userid=' . $uid . '&rsstoken=' . $rsstoken);
 header("X-DNZB-Category: " . $reldata["category_name"]);
 header("X-DNZB-Details: " . $page->serverurl . 'details/' . $_GET["id"]);
 if (!empty($reldata['imdbid']) && $reldata['imdbid'] > 0) {
     header("X-DNZB-MoreInfo: http://www.imdb.com/title/tt" . $reldata['imdbid']);
 } else {
     if (!empty($reldata['rageid']) && $reldata['rageid'] > 0) {
         header("X-DNZB-MoreInfo: http://www.tvrage.com/shows/id-" . $reldata['rageid']);
示例#20
0
<?php

$filename = dirname(__FILE__) . "/004.txt.gz";
$unset_var = 10;
unset($unset_var);
$variation = array('unset var' => @$unset_var, 'undefined var' => @$undefined_var, 'empty string DQ' => "", 'empty string SQ' => '', 'uppercase NULL' => NULL, 'lowercase null' => null);
foreach ($variation as $var) {
    var_dump(readgzfile($filename, $var));
}
?>
===DONE===
示例#21
0
 public function loadFromFileCache()
 {
     global $wgOut, $wgMimeType, $wgLanguageCode;
     wfDebug(__METHOD__ . "()\n");
     $filename = $this->fileCacheName();
     // Raw pages should handle cache control on their own,
     // even when using file cache. This reduces hits from clients.
     if ($this->mType !== 'raw') {
         $wgOut->sendCacheControl();
         header("Content-Type: {$wgMimeType}; charset=UTF-8");
         header("Content-Language: {$wgLanguageCode}");
     }
     if ($this->useGzip()) {
         if (wfClientAcceptsGzip()) {
             header('Content-Encoding: gzip');
         } else {
             /* Send uncompressed */
             readgzfile($filename);
             return;
         }
     }
     readfile($filename);
     $wgOut->disable();
     // tell $wgOut that output is taken care of
 }
示例#22
0
文件: getnzb.php 项目: zetas/nZEDb
if ($relData) {
    $rel->updateGrab($_GET["id"]);
    $page->users->addDownloadRequest($uid);
    $page->users->incrementGrabs($uid);
    if (isset($_GET["del"]) && $_GET["del"] == 1) {
        $page->users->delCartByUserAndRelease($_GET["id"], $uid);
    }
} else {
    header("X-DNZB-RCode: 404");
    header("X-DNZB-RText: Release not found!");
    $page->show404();
}
// Start reading output buffer.
ob_start();
// De-gzip the NZB and store it in the output buffer.
readgzfile($nzbPath);
$cleanName = str_replace(array(',', ' ', '/'), '_', $relData["searchname"]);
// Set the NZB file name.
header("Content-Disposition: attachment; filename=" . $cleanName . ".nzb");
// Get the size of the NZB file.
header("Content-Length: " . ob_get_length());
header("Content-Type: application/x-nzb");
header("Expires: " . date('r', time() + 31536000));
// Set X-DNZB header data.
header("X-DNZB-Failure: " . $page->serverurl . 'failed/' . '?guid=' . $_GET['id'] . '&userid=' . $uid . '&rsstoken=' . $rssToken);
header("X-DNZB-Category: " . $relData["category_name"]);
header("X-DNZB-Details: " . $page->serverurl . 'details/' . $_GET["id"]);
if (!empty($relData['imdbid']) && $relData['imdbid'] > 0) {
    header("X-DNZB-MoreInfo: http://www.imdb.com/title/tt" . $relData['imdbid']);
} else {
    if (!empty($relData['tvdb']) && $relData['tvdb'] > 0) {
示例#23
0
 /**
  * Read from cache to context output
  * @param $context IContextSource
  * @return void
  */
 public function loadFromFileCache(IContextSource $context)
 {
     global $wgMimeType, $wgLanguageCode;
     wfDebug(__METHOD__ . "()\n");
     $filename = $this->cachePath();
     $context->getOutput()->sendCacheControl();
     header("Content-Type: {$wgMimeType}; charset=UTF-8");
     header("Content-Language: {$wgLanguageCode}");
     if ($this->useGzip()) {
         if (wfClientAcceptsGzip()) {
             header('Content-Encoding: gzip');
             readfile($filename);
         } else {
             /* Send uncompressed */
             wfDebug(__METHOD__ . " uncompressing cache file and sending it\n");
             readgzfile($filename);
         }
     } else {
         readfile($filename);
     }
     $context->getOutput()->disable();
     // tell $wgOut that output is taken care of
 }
示例#24
0
 /**
  * Loads and outputs the file from the file cache
  */
 public function outputFile()
 {
     if (ResourceLoader::clientAcceptsGzip() && substr($this->filename, -3) == '.gz') {
         header('Content-Encoding: gzip');
         readfile($this->filename);
         return true;
     }
     // Output without gzip:
     if (substr($this->filename, -3) == '.gz') {
         readgzfile($this->filename);
     } else {
         readfile($this->filename);
     }
     return true;
 }
示例#25
0
<?php

$use_include_path = $variation = array('lowercase true' => true, 'lowercase false' => false, 'uppercase TRUE' => TRUE, 'uppercase FALSE' => FALSE);
foreach ($variation as $var) {
    var_dump(readgzfile($var, $use_include_path));
}
?>
===DONE===
示例#26
0
 /**
  * Download release via HTTP
  *
  * @param string Name of the package
  * @param string Version string
  * @param string Filename
  * @param boolean Uncompress file before downloading?
  * @return mixed
  * @static
  */
 static function HTTPdownload($package, $version = null, $file = null, $uncompress = false)
 {
     global $dbh;
     include_once 'pear-database-package.php';
     $package_id = package::info($package, 'packageid', true);
     if (!$package_id) {
         return PEAR::raiseError("release download:: package '" . htmlspecialchars($package) . "' does not exist");
     } elseif (PEAR::isError($package_id)) {
         return $package_id;
     }
     if ($file !== null) {
         if (substr($file, -4) == '.tar') {
             $file = substr($file, 0, -4) . '.tgz';
             $uncompress = true;
         }
         $row = $dbh->getRow("SELECT fullpath, `release`, id FROM files " . "WHERE basename LIKE ?", array($file), DB_FETCHMODE_ASSOC);
         if (PEAR::isError($row)) {
             return $row;
         } elseif ($row === null) {
             return PEAR::raiseError("File '{$file}' not found");
         }
         $path = $row['fullpath'];
         $log_release = $row['release'];
         $log_file = $row['id'];
         $basename = $file;
     } elseif ($version === null) {
         // Get the most recent version
         $row = $dbh->getRow("SELECT id FROM releases " . "WHERE package = {$package_id} " . "ORDER BY releasedate DESC", DB_FETCHMODE_ASSOC);
         if (PEAR::isError($row)) {
             return $row;
         }
         $release_id = $row['id'];
     } elseif (release::isValidState($version)) {
         $version = strtolower($version);
         // Get the most recent version with a given state
         $row = $dbh->getRow("SELECT id FROM releases " . "WHERE package = {$package_id} " . "AND state = '{$version}' " . "ORDER BY releasedate DESC", DB_FETCHMODE_ASSOC);
         if (PEAR::isError($row)) {
             return $row;
         }
         $release_id = $row['id'];
         if (!isset($release_id)) {
             return PEAR::raiseError("{$package} does not have any releases with state \"{$version}\"");
         }
     } else {
         // Get a specific release
         $row = $dbh->getRow("SELECT id FROM releases " . "WHERE package = {$package_id} " . "AND version = '{$version}'", DB_FETCHMODE_ASSOC);
         if (PEAR::isError($row)) {
             return $row;
         }
         $release_id = $row['id'];
     }
     if (!isset($path) && isset($release_id)) {
         $sql = "SELECT fullpath, basename, id FROM files WHERE `release` = " . $release_id;
         $row = $dbh->getRow($sql, DB_FETCHMODE_ORDERED);
         if (PEAR::isError($row)) {
             return $row;
         }
         list($path, $basename, $log_file) = $row;
         if (empty($path) || !@is_file($path)) {
             return PEAR::raiseError("release download:: no version information found");
         }
     }
     if (isset($path)) {
         if (!isset($log_release)) {
             $log_release = $release_id;
         }
         release::logDownload($package_id, $log_release, $log_file);
         header('Last-modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', filemtime($path)));
         header('Content-type: application/octet-stream');
         if ($uncompress) {
             $tarname = preg_replace('/\\.tgz\\z/', '.tar', $basename);
             header('Content-disposition: attachment; filename="' . $tarname . '"');
             readgzfile($path);
         } else {
             header('Content-disposition: attachment; filename="' . $basename . '"');
             header('Content-length: ' . filesize($path));
             readfile($path);
         }
         return true;
     }
     header('HTTP/1.0 404 Not Found');
     echo 'File not found';
 }
function gzTempfile($file, $new = null)
{
    global $filesystem;
    ob_start();
    readgzfile($file);
    $data = ob_get_contents();
    ob_end_clean();
    if (empty($new)) {
        $new = 'temp/' . md5(microtime()) . '.enc.tar';
    }
    $filesystem->file_put_contents($new, $data);
    return $new;
}
示例#28
0
 /**
  * Writes a zip file of an array of release guids directly to the stream
  */
 public function getZipped($guids)
 {
     $s = new Settings();
     $this->nzb = new NZB();
     $zipfile = new zipfile();
     foreach ($guids as $guid) {
         $nzbpath = $this->nzb->getNZBPath($guid, $s->getSetting('nzbpath'));
         if (file_exists($nzbpath)) {
             ob_start();
             @readgzfile($nzbpath);
             $nzbfile = ob_get_contents();
             ob_end_clean();
             $filename = $guid;
             $r = $this->getByGuid($guid);
             if ($r) {
                 $filename = $r["searchname"];
             }
             $zipfile->addFile($nzbfile, $filename . ".nzb");
         }
     }
     return $zipfile->file();
 }
 *
 * @version $Id: changelog.php 30792 2010-03-05 22:55:26Z mehrwert $
 * @package phpMyAdmin
 */

/**
 * Load paths.
 */
require('./libraries/vendor_config.php');

/**
 * Read changelog.
 */
if (substr(CHANGELOG_FILE, -3) == '.gz') {
    ob_start();
    readgzfile(CHANGELOG_FILE);
    $changelog = ob_get_contents();
    ob_end_clean();
} else {
    $changelog = file_get_contents(CHANGELOG_FILE);
}

/**
 * Whole changelog in variable.
 */
$changelog = htmlspecialchars($changelog);

$replaces = array(
    '@(http://[./a-zA-Z0-9.-_-]*[/a-zA-Z0-9_])@'
    => '<a href="\\1">\\1</a>',
示例#30
0
 /**
  * gzファイルの中身を取得する
  */
 public static function get_gzfile_contents($filepath)
 {
     if (is_readable($filepath)) {
         if (FILECTL_HAVE_COMPRESS_ZLIB_WRAPPER) {
             return file_get_contents('compress.zlib://' . realpath($filepath));
         }
         ob_start();
         readgzfile($filepath);
         return ob_get_clean();
     } else {
         return false;
     }
 }