本文整理汇总了PHP中fpassthru函数的典型用法代码示例。如果您正苦于以下问题:PHP fpassthru函数的具体用法?PHP fpassthru怎么用?PHP fpassthru使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fpassthru函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: deliverFile
function deliverFile($file, $contentEncoding)
{
if (file_exists($file) && ($filehandle = fopen($file, 'r'))) {
$fileCTime = filectime($file);
// We don't need to deliver the file, if it hasn't been modified
// since the last time it has been requested.
if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
$sinceTime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
if ($sinceTime !== false && $sinceTime >= $fileCTime) {
# header('Debug-Requested-File: ' . $file);
header('Debug-Last-Modified: ' . date('r', $fileCTime));
header('Debug-If-Modified-Since: ' . date('r', $sinceTime));
header('HTTP/1.0 304 Not Modified');
exit;
}
}
header('Last-Modified: ' . date('r', $fileCTime));
# header('Debug-Requested-File: ' . $file);
header('Content-Type: application/x-java-archive');
header('Content-Length :' . filesize($file));
if ($contentEncoding != null) {
header('Content-Encoding: ' . $contentEncoding);
}
fpassthru($filehandle);
fclose($filehandle);
} else {
header('HTTP/1.0 404 Not Found');
}
exit;
}
开发者ID:BackupTheBerlios,项目名称:jcurl-svn,代码行数:30,代码来源:pack200.php
示例2: index
public function index()
{
$this->auto_render = FALSE;
if ($this->service == "" && $this->host == "") {
url::redirect("graph", 302);
}
$this->data->readXML($this->host, $this->service);
if ($this->auth->is_authorized($this->data->MACRO['AUTH_HOSTNAME'], $this->data->MACRO['AUTH_SERVICEDESC']) === FALSE) {
header('Content-Type: application/xml');
print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
print "<NAGIOS>\n";
print "<ERROR>not authorized</ERROR>\n";
print "</NAGIOS>\n";
exit;
} else {
$xmlfile = $this->config->conf['rrdbase'] . $this->host . "/" . $this->service . ".xml";
if (is_readable($xmlfile)) {
$fh = fopen($xmlfile, 'r');
header('Content-Type: application/xml');
fpassthru($fh);
fclose($fh);
exit;
} else {
header('Content-Type: application/xml');
print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
print "<NAGIOS>\n";
print "<ERROR>file not found</ERROR>\n";
print "</NAGIOS>\n";
}
}
}
开发者ID:rbarraud,项目名称:pnp4nagios,代码行数:31,代码来源:xml.php
示例3: graph_error
function graph_error($string)
{
global $vars, $config, $debug, $graphfile;
$vars['bg'] = 'FFBBBB';
include 'includes/graphs/common.inc.php';
$rrd_options .= ' HRULE:0#555555';
$rrd_options .= " --title='" . $string . "'";
rrdtool_graph($graphfile, $rrd_options);
if ($height > '99') {
shell_exec($rrd_cmd);
d_echo('<pre>' . $rrd_cmd . '</pre>');
if (is_file($graphfile) && !$debug) {
header('Content-type: image/png');
$fd = fopen($graphfile, 'r');
fpassthru($fd);
fclose($fd);
unlink($graphfile);
exit;
}
} else {
if (!$debug) {
header('Content-type: image/png');
}
$im = imagecreate($width, $height);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
imagepng($im);
imagedestroy($im);
exit;
}
}
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:graph.inc.php
示例4: dump
/**
* Dump the contents of the file using fpassthru().
*
* @return void
* @throws Exception if no file or contents.
*/
function dump()
{
if (!$this->data) {
// hmmm .. must be a file that needs to read in
if ($this->inFile) {
$fp = @fopen($this->inFile, "rb");
if (!$fp) {
throw new Exception('Unable to open file: ' . $this->inFile);
}
fpassthru($fp);
@fclose($fp);
} else {
throw new Exception('No data to dump');
}
} else {
$realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$docuroot = explode('/', $realdocuroot);
array_pop($docuroot);
$pathhome = implode('/', $docuroot) . '/';
array_pop($docuroot);
$pathTrunk = implode('/', $docuroot) . '/';
require_once $pathTrunk . 'gulliver/system/class.inputfilter.php';
$filter = new InputFilter();
$data = $filter->xssFilterHard($this->data);
echo $data;
}
}
开发者ID:emildev35,项目名称:processmaker,代码行数:33,代码来源:Blob.php
示例5: download
private function download($dir, $file)
{
chdir($dir);
// if the filename is in the array
if (preg_match("/\\.zip\$/", $file)) {
// and it exists
if (file_exists($file)) {
// and is readable
if (is_readable($file)) {
// get its size
$size = filesize($file);
// open it for reading
if ($fp = @fopen("{$file}", 'r')) {
// send the headers
header('Content-type: application/zip');
header("Content-Length: {$size}");
header("Content-Disposition: attachment; filename=\"{$file}\"");
// send the file content
fpassthru($fp);
// close the file
fclose($fp);
// and quit
exit;
}
}
}
}
}
开发者ID:battle-io,项目名称:web-php,代码行数:28,代码来源:bullshit.php
示例6: ShowAction
public function ShowAction($id = '')
{
global $CONFIG;
$id += 0;
if (!$id) {
throw new ApplicationException("404 File Not Found");
}
$size = reqs('size');
$is_preview = reqi('preview');
if ($is_preview) {
$item = $this->model->one($id);
if ($item['is_image']) {
$this->model->transmit_file($id, $size, 'inline');
} else {
#if it's not an image and requested preview - return std image
$filepath = $CONFIG['site_root'] . '/img/att_file.png';
# TODO move to web.config or to model?
header('Content-type: ' . UploadUtils::get_mime4ext($item['ext']));
$fp = fopen($filepath, 'rb');
fpassthru($fp);
}
} else {
$this->model->transmit_file($id, $size, 'inline');
}
}
开发者ID:ozkangol,项目名称:osafw-php,代码行数:25,代码来源:Att.php
示例7: output
/**
* Output json
*
* @param array data to output
* @return void
* @author Dmitry (dio) Levashov
**/
protected function output(array $data)
{
$header = isset($data['header']) ? $data['header'] : $this->header;
unset($data['header']);
$headers = array();
if ($header) {
foreach ((array) $header as $headerString) {
if (strpos($headerString, ':') !== false) {
list($key, $value) = explode(':', $headerString, 2);
$headers[$key] = $value;
}
}
}
if (isset($data['pointer'])) {
$this->response = new StreamedResponse(function () use($data) {
if (stream_get_meta_data($data['pointer'])['seekable']) {
rewind($data['pointer']);
}
fpassthru($data['pointer']);
if (!empty($data['volume'])) {
$data['volume']->close($data['pointer'], $data['info']['hash']);
}
}, 200, $headers);
} else {
if (!empty($data['raw']) && !empty($data['error'])) {
$this->response = new JsonResponse($data['error'], 500);
} else {
$this->response = new JsonResponse($data, 200, $headers);
}
}
}
开发者ID:barryvdh,项目名称:laravel-elfinder,代码行数:38,代码来源:Connector.php
示例8: output
/**
* Output a file to the browser
*
* @param string $file The file to output
*
* @since 1.0.0
*/
public function output($file)
{
@error_reporting(E_ERROR);
$name = basename($file);
$type = $this->getContentType($name);
$size = @filesize($file);
$mod = date('r', filemtime($file));
while (@ob_end_clean()) {
}
// required for IE, otherwise Content-disposition is ignored
if (ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}
// set header
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
header("Content-Transfer-Encoding: binary");
header('Content-Type: ' . $type);
header('Content-Disposition: attachment;' . ' filename="' . $name . '";' . ' modification-date="' . $mod . '";' . ' size=' . $size . ';');
header("Content-Length: " . $size);
// set_time_limit doesn't work in safe mode
if (!ini_get('safe_mode')) {
@set_time_limit(0);
}
// output file
$handle = fopen($file, 'rb');
fpassthru($handle);
fclose($handle);
}
开发者ID:JBZoo,项目名称:Zoo-Changelog,代码行数:37,代码来源:filesystem.php
示例9: streamContent
function streamContent($file, $type)
{
if ($type == "image") {
$file_bits = preg_split('/\\./', $file);
if (count($file_bits) == 2) {
if ($file_bits[1] == "png") {
$content = "image/png";
} else {
if ($file_bits[1] == "gif") {
$content = "image/gif";
}
}
}
}
if (!isset($content)) {
errorOut("Invalid Static Content", 404, array("Type specified - {$type}", "File specified - {$file}"));
}
$real_file = BASEPATH . "static/{$type}/" . $file;
if (is_file($real_file)) {
header("Content-Length:" . filesize($real_file));
header("Content-Type: " . $content);
$fh = fopen($real_file, "r");
fpassthru($fh);
fclose($fh);
} else {
errorOut("Invalid Static Content", 404, array("Filename - {$real_file}"));
}
exit;
}
开发者ID:ronfesta,项目名称:simiangrid,代码行数:29,代码来源:common.php
示例10: execute
public function execute(InputInterface $input, OutputInterface $output)
{
$solrRoot = $this->getContainer()->getParameter('room13.solr.config.solr_root');
$schemaRoot = $this->getContainer()->getParameter('room13.solr.config.schema_root');
$p = popen("cd {$solrRoot} && java -Dsolr.solr.home={$schemaRoot} -jar start.jar", "r");
fpassthru($p);
}
开发者ID:roomthirteen,项目名称:Room13SolrBundle,代码行数:7,代码来源:SolrServiceCommand.php
示例11: generate_csv
protected function generate_csv()
{
extract($this->args);
$csv = fopen('php://memory', 'w');
$col_names = array();
$count = 0;
// Generate CSV lines
foreach ($data as $line) {
if ($column_names && $count < 1) {
foreach ($line as $col_name => $col_value) {
array_push($col_names, $col_name);
}
fputcsv($csv, $col_names, $delimiter);
}
fputcsv($csv, $line, $delimiter);
$count++;
}
// Rewind the CSV file
fseek($csv, 0);
// Set CSV file headers
header('Content-Type: application/csv');
header('Content-Disposition: attachement; filename="' . $filename . '.csv"');
header('Content-Cache: no-cache, must-revalidate');
header('Pragma: no-cache');
// Send the generated CSV to the browser
fpassthru($csv);
exit;
}
开发者ID:alekhen,项目名称:intoor-lib,代码行数:28,代码来源:csv.php
示例12: handle_file_cache
function handle_file_cache($file_cache_r, $isThumbnail = FALSE)
{
if ($file_cache_r !== FALSE) {
if ($file_cache_r['cache_type'] == 'ITEM') {
if ($isThumbnail) {
$file = file_cache_open_thumbnail_file($file_cache_r);
}
// fallback on big image
if (!$file) {
if ($file_cache_r['upload_file_ind'] != 'Y') {
$file = file_cache_open_file($file_cache_r);
}
}
} else {
$file = file_cache_open_file($file_cache_r);
}
if ($file) {
header("Content-disposition: inline; filename=" . $file_cache_r['cache_file']);
header("Content-type: " . $file_cache_r['content_type']);
fpassthru($file);
fclose($file);
} else {
// final fallback
output_cache_file($file_cache_r['url']);
}
return TRUE;
} else {
return FALSE;
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:30,代码来源:url.php
示例13: testRequestToOutputFile
function testRequestToOutputFile()
{
$client = new ProxyClient();
$client->URL = df_absolute_url('tests/test_ProxyClient/test1.html');
$outputFile = tempnam(sys_get_temp_dir(), 'test_ProxyClient');
$client->outputFile = $outputFile;
$client->process();
$this->assertEquals(null, $client->content, 'Content should be written to output file, not saved to variable.');
$expected = file_get_contents('tests/test_ProxyClient/test1.html');
$doc = new DOMDocument();
@$doc->loadHtml($expected);
$expected = $doc->saveHtml();
$actual = file_get_contents($outputFile);
$actual = '';
$fh = fopen($outputFile, 'r');
while (!feof($fh) and trim($line = fgets($fh, 1024))) {
// We skip the headers
}
ob_start();
fpassthru($fh);
fclose($fh);
$actual = ob_get_contents();
ob_end_clean();
unset($doc);
$doc = new DOMDocument();
@$doc->loadHtml($actual);
$actual = $doc->saveHtml();
unset($doc);
$this->assertEquals($expected, $actual);
}
开发者ID:gtoffoli,项目名称:swete,代码行数:30,代码来源:test_ProxyClient.php
示例14: makethumbnail
function makethumbnail($src_file, $newSize, $method)
{
global $CONFIG;
$content_type = array(IMAGETYPE_GIF => 'gif', IMAGETYPE_JPEG => 'jpeg', IMAGETYPE_PNG => 'png');
// Checks that file exists and is readable
if (!filesize($src_file) || !is_readable($src_file)) {
header("Content-type: image/gif");
fpassthru(fopen(READ_ERROR_ICON, 'rb'));
exit;
}
// find the image size, no size => unknow type
$imginfo = getimagesize($src_file);
if ($imginfo == null) {
header("Content-type: image/gif");
fpassthru(fopen(UNKNOW_ICON, 'rb'));
exit;
}
// GD can't handle gif images
if ($imginfo[2] == IMAGETYPE_GIF && ($method == 'gd1' || $method == 'gd2') && !function_exists('imagecreatefromgif')) {
header("Content-type: image/gif");
fpassthru(fopen(GIF_ICON, 'rb'));
exit;
}
// height/width
$ratio = max(max($imginfo[0], $imginfo[1]) / $newSize, 1.0);
$dest_info[0] = intval($imginfo[0] / $ratio);
$dest_info[1] = intval($imginfo[1] / $ratio);
$dest_info['quality'] = intval($CONFIG['jpeg_qual']);
require_once 'includes/imaging/imaging.inc';
if (!Graphic::show($src_file, $dest_info)) {
return false;
}
}
开发者ID:cbsistem,项目名称:nexos,代码行数:33,代码来源:showthumbbatch.php
示例15: send
public function send()
{
$fp = fopen($this->content, 'rb');
header("Content-Type:" . $this->contentType, true, $this->status);
header("Content-Length: " . filesize($this->content));
fpassthru($fp);
}
开发者ID:Sfaar,项目名称:webvent,代码行数:7,代码来源:MediaResponse.php
示例16: get_VM
function get_VM($user, $mid, &$errors)
{
global $config, $lang_str;
if (!$this->connect_to_db($errors)) {
return false;
}
$q = "select subject, file from " . $config->data_sql->table_voice_silo . " where mid=" . $mid . " and " . $this->get_indexing_sql_where_phrase_uri($user);
$res = $this->db->query($q);
if (DB::isError($res)) {
log_errors($res, $errors);
return false;
}
if (!$res->numRows()) {
$errors[] = $lang_str['err_voice_msg_not_found'];
return false;
}
$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
$res->free();
@($fp = fopen($config->voice_silo_dir . $row->file, 'r'));
if (!$fp) {
$errors[] = $lang_str['err_can_not_open_message'];
return false;
}
Header("Content-Disposition: attachment;filename=" . RawURLEncode(($row->subject ? $row->subject : "received message") . ".wav"));
Header("Content-type: audio/wav");
@fpassthru($fp);
@fclose($fp);
return true;
}
开发者ID:BackupTheBerlios,项目名称:serweb,代码行数:29,代码来源:method.get_vm.php
示例17: output
protected function output(array $data)
{
$header = isset($data['header']) ? $data['header'] : $this->header;
unset($data['header']);
if ($header) {
if (is_array($header)) {
foreach ($header as $h) {
header($h);
}
} else {
header($header);
}
}
if (isset($data['pointer'])) {
rewind($data['pointer']);
fpassthru($data['pointer']);
if (!empty($data['volume'])) {
$data['volume']->close($data['pointer'], $data['info']['hash']);
}
return;
} else {
if (!empty($data['raw']) && !empty($data['error'])) {
return $data['error'];
} else {
return $data;
}
}
}
开发者ID:blrik,项目名称:bWorks,代码行数:28,代码来源:elFinderConnector.php
示例18: GetXLS
/**
* Function exports the report in a Excel sheet
* @param Vtiger_Request $request
*/
function GetXLS(Vtiger_Request $request)
{
$recordId = $request->get('record');
error_reporting(0);
//error_reporting(63);ini_set("display_errors",1);
if (ITS4YouReports::isStoredITS4YouReport() === true) {
$ogReport = ITS4YouReports::getStoredITS4YouReport();
} else {
$ogReport = new ITS4YouReports();
}
$generateObj = new GenerateObj($ogReport);
$report_data = $generateObj->GenerateReport($recordId, "XLS");
//ITS4YouReports::sshow($report_data);
//exit;
$rootDirectory = vglobal('root_directory');
$tmpDir = vglobal('tmp_dir');
$tempFileName = tempnam($rootDirectory . $tmpDir, 'xls');
$fileName = $ogReport->reportname . '.xls';
$default_charset = vglobal("default_charset");
$fileName = html_entity_decode($fileName, ENT_QUOTES, $default_charset);
$generateObj->writeReportToExcelFile($tempFileName, $report_data);
//ITS4YouReports::sshow($report_data);
//exit;
if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
header('Pragma: public');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
}
header('Content-Type: application/x-msexcel');
header('Content-Length: ' . @filesize($tempFileName));
header('Content-disposition: attachment; filename="' . $fileName . '"');
$fp = fopen($tempFileName, 'rb');
fpassthru($fp);
//unlink($tempFileName);
//echo "<pre>";print_r($report_data);echo "</pre>";
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:39,代码来源:ExportReport.php
示例19: acaodownload
public function acaodownload()
{
$trb_cod = Sistema_Variavel::get('trb_cod');
$file = UPLOAD_DIR . $trb_cod . ".PDF";
if (file_exists($file)) {
$arq = $file;
$ext = ".pdf";
}
$file = UPLOAD_DIR . $trb_cod . ".DOC";
if (file_exists($file)) {
$arq = $file;
$ext = ".doc";
}
if ($arq != "") {
header("Content-Type: application/save");
header("Content-Length:" . filesize($arq));
header('Content-Disposition: attachment; filename="' . Sistema_Variavel::get('trb_cod') . $ext);
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Pragma: no-cache');
// nesse momento ele le o arquivo e envia
$fp = fopen("{$arq}", "r");
fpassthru($fp);
fclose($fp);
} else {
$msg = Sistema_Mensagem::instanciar();
$msg->setErro("Não foi submetido arquivo para este trabalho");
}
}
开发者ID:anselmobattisti,项目名称:Eventos,代码行数:29,代码来源:trabalho.php
示例20: getAction
public function getAction()
{
$this->getHelper('layout')->disableLayout();
$this->getHelper('viewRenderer')->setNoRender(true);
$media = $this->getInvokeArg('bootstrap')->getOption('media');
if (!(null != ($fileRow = $this->_getParam('file')) && $fileRow instanceof Media_Model_DbTable_Row_File)) {
$mediaAdapter = Media_Model_Adapter::factory($media['adapter'], $media['params']);
$id = bin2hex(Centurion_Inflector::urlDecode($this->_request->getParam('id')));
$key = bin2hex(Centurion_Inflector::urlDecode($this->_request->getParam('key')));
$fileRow = $this->_helper->getObjectOr404('media/file', array('id' => $id));
$this->forward404If(!$mediaAdapter->isValidKey($fileRow, $key, '', $media['key_lifetime']));
}
$source = $media['uploads_dir'] . DIRECTORY_SEPARATOR . $fileRow->local_filename;
if (null == $this->_getParam('noAdapter', null)) {
$isSaved = $mediaAdapter->save($source, $fileRow->getRelativePath(null, false, true), true);
if ($isSaved) {
Centurion_Db::getSingleton('media/duplicate')->insert(array('file_id' => $fileRow->id, 'adapter' => $media['adapter'], 'params' => serialize($media['params']), 'dest' => $fileRow->getRelativePath(null, false, true)));
return $this->getHelper('redirector')->gotoUrlAndExit($fileRow->getStaticUrl());
}
}
$offset = 24 * 60 * 60 * 365;
$this->getResponse()->setHeader('Content-type', $fileRow->mime)->setHeader('Content-Length', filesize($source))->setHeader('Content-Disposition', sprintf('inline; filename="%s";', $fileRow->filename))->setHeader('Cache-Control', sprintf('max-age=%d, public', $offset))->setHeader('Expires', sprintf('%s GMT', gmdate('D, d M Y H:i:s', time() + $offset)))->sendHeaders();
while (@ob_end_flush()) {
}
$fp = fopen($source, 'rb');
fpassthru($fp);
fclose($fp);
$this->getResponse()->clearHeaders();
}
开发者ID:netconstructor,项目名称:Centurion,代码行数:29,代码来源:FileController.php
注:本文中的fpassthru函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论