本文整理汇总了PHP中sendContentType函数的典型用法代码示例。如果您正苦于以下问题:PHP sendContentType函数的具体用法?PHP sendContentType怎么用?PHP sendContentType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendContentType函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startUpError
/**
*Errors before the database connection has been made
*/
function startUpError($msg, $title)
{
if (!defined('_CHARSET')) {
define('_CHARSET', 'UTF-8');
}
if (!defined('_HTML_XML_NAME_SPACE_AND_LANG_CODE')) {
define('_HTML_XML_NAME_SPACE_AND_LANG_CODE', 'xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"');
}
sendContentType('text/html', '', _CHARSET);
?>
<html <?php
echo _HTML_XML_NAME_SPACE_AND_LANG_CODE;
?>
>
<head><meta http-equiv="Content-Type" content="text/html; charset=<?php
echo _CHARSET;
?>
" />
<title><?php
echo htmlspecialchars($title, ENT_QUOTES);
?>
</title></head>
<body>
<h1><?php
echo htmlspecialchars($title, ENT_QUOTES);
?>
</h1>
<?php
echo $msg;
?>
</body>
</html>
<?php
exit;
}
示例2: sendContentType
<?php
$ROOTDIR = '..';
require "{$ROOTDIR}/base.php";
sendContentType();
openDocument();
?>
<script type="text/javascript">
//<![CDATA[
var playing = false;
var testTimeout = false;
window.onload = function() {
menuInit();
initVideo();
registerKeyEventListener();
initApp();
setInstr('Please run all steps in the displayed order. Navigate to the test using up/down, then press OK to start the test. For some tests, you may need to follow some instructions.');
showVidState();
};
function handleKeyCode(kc) {
if (kc==VK_UP) {
menuSelect(selected-1);
return true;
} else if (kc==VK_DOWN) {
menuSelect(selected+1);
return true;
} else if (kc==VK_ENTER) {
var liid = opts[selected].getAttribute('name');
if (liid=='exit') {
document.location.href = '../index.php';
示例3: parse
function parse($type)
{
global $manager, $CONF, $skinid;
$manager->notify('InitSkinParse', array('skin' => &$this, 'type' => $type));
$skinid = $this->id;
// set output type
sendContentType($this->getContentType(), 'skin', _CHARSET);
// set skin name as global var (so plugins can access it)
global $currentSkinName;
$currentSkinName = $this->getName();
$contents = $this->getContent($type);
if (!$contents) {
// use base skin if this skin does not have contents
$defskin =& new SKIN($CONF['BaseSkin']);
$contents = $defskin->getContent($type);
if (!$contents) {
echo _ERROR_SKIN;
return;
}
}
$actions = $this->getAllowedActionsForType($type);
$manager->notify('PreSkinParse', array('skin' => &$this, 'type' => $type, 'contents' => &$contents));
$skinid = $this->id;
// set IncludeMode properties of parser
PARSER::setProperty('IncludeMode', $this->getIncludeMode());
PARSER::setProperty('IncludePrefix', $this->getIncludePrefix());
$handler =& new ACTIONS($type, $this);
$parser =& new PARSER($actions, $handler);
$handler->setParser($parser);
$handler->setSkin($this);
$parser->parse($contents);
$manager->notify('PostSkinParse', array('skin' => &$this, 'type' => $type));
$skinid = $this->id;
}
示例4: streamFile
//.........这里部分代码省略.........
if ($download) {
$do_resample = false;
}
// Are they resampling or transcoding?
if ($do_resample) {
// Ok, if resampling isn't set let's go with the default
if ($resample == "") {
$resample = $always_resample_rate;
}
// Now let's load up the resampling service
$jzSERVICES = new jzServices();
$jzSERVICES->loadService("resample", "resample");
$jzSERVICES->resampleFile($path, $name, $resample);
// Now let's unset what they are playing
$be = new jzBackend();
$be->unsetPlaying($_GET['jz_user'], $_GET['sid']);
return;
}
// Now we need to know if this is an ID3 image or not
// First let's get their limit
$limit = "7";
$size = filesize($path);
$range = getContentRange($size);
if ($range !== false) {
$range_from = $range[0];
$range_to = $range[1];
} else {
$range_from = 0;
$range_to = $size - 1;
}
$ps3 = false;
$allheaders = getallheaders();
if (isset($allheaders['User-Agent']) && $allheaders['User-Agent'] == "PLAYSTATION 3") {
$ps3 = true;
}
if ($ps3) {
// ps3 is picky and bizarre.
if ($range_from > $size) {
// This happens if the ps3 thinks the file
// is larger than it is, and sending a
// This is supposed to be a read of the id3v1 tag at
// the end of a file (128 bytes), or the lyrics tag
// (138 bytes)
$requested = $range_to - $range_from + 1;
$range_from = $size - $requested;
$range_to = $size - 1;
header("HTTP/1.1 206 Partial content");
} else {
if ($range_from == 0 && $size == $range_to + 1) {
header("HTTP/1.1 200 OK");
} else {
header("HTTP/1.1 206 Partial content");
header("CONTENT-RANGE: bytes {$range_from}-{$range_to}/{$size}");
}
}
header("transferMode.dlna.org: Streaming");
header("contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=017000 00000000000000000000000000");
header("Accept-Ranges: bytes");
header("Connection: keep-alive");
header("Content-Length: " . ($size - $range_from));
} else {
if ($range === false) {
// Content length has already been sent
header("Content-Length: " . (string) $size);
} else {
header("HTTP/1.1 206 Partial Content");
header("Accept-Range: bytes");
header("Content-Length: " . ($size - $range_from));
header("Content-Range: bytes {$range_from}" . "-" . $range_to . "/{$size}");
}
}
if ($contentTypeFor !== false) {
sendContentType($contentTypeFor);
}
if (!$ps3) {
header("Content-Disposition: inline; filename=\"" . $name . "\"");
header("Expires: " . gmdate("D, d M Y H:i:s", mktime(date("H") + 2, date("i"), date("s"), date("m"), date("d"), date("Y"))) . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", filemtime($path)) . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
}
if ($file = fopen($path, 'rb')) {
@set_time_limit(0);
fseek($file, $range_from);
while (!feof($file) and connection_status() == 0 and ($cur_pos = ftell($file)) < $range_to + 1) {
print fread($file, min(1024 * $speed_limit, $range_to + 1 - $cur_pos));
flush();
if ($limit !== false) {
sleep(1);
}
}
$status = connection_status() == 0;
fclose($file);
@set_time_limit(30);
}
// Now let's unset what they are playing
$be = new jzBackend();
$be->unsetPlaying($_GET['jz_user'], $_GET['sid']);
return $status;
}
示例5: array
* @license http://nucleuscms.org/license.txt GNU General Public License
* @copyright Copyright (C) 2002-2007 The Nucleus Group
* @version $Id: media.php,v 1.8.2.1 2007-09-07 07:36:44 kimitake Exp $
* $NucleusJP: media.php,v 1.8 2007/03/20 19:32:19 kmorimatsu Exp $
*
*/
$CONF = array();
// defines how much media items will be shown per page. You can override this
// in config.php if you like. (changing it in config.php instead of here will
// allow your settings to be kept even after a Nucleus upgrade)
$CONF['MediaPerPage'] = 10;
// include all classes and config data
require '../../../../../config.php';
include $DIR_LIBS . 'MEDIA.php';
// media classes
sendContentType('application/xhtml+xml', 'media');
// user needs to be logged in to use this
if (!$member->isLoggedIn()) {
media_loginAndPassThrough();
exit;
}
// check if member is on at least one teamlist
$query = 'SELECT * FROM ' . sql_table('team') . ' WHERE tmember=' . $member->getID();
if ($manager->pluginInstalled('NP_SQLite')) {
$teams = nucleus_mysql_query($query);
if (nucleus_mysql_num_rows($teams) == 0) {
media_doError(_ERROR_DISALLOWEDUPLOAD);
}
} else {
$teams = sql_query($query);
if (sql_num_rows($teams) == 0) {
示例6: array_push
array_push($aFound, $fileDesc);
}
}
if (@is_writable('../config.php')) {
array_push($aFound, _ERRORS_CONFIGPHP);
}
if (sizeof($aFound) > 0) {
startUpError(_ERRORS_STARTUPERROR1 . implode($aFound, '</li><li>') . _ERRORS_STARTUPERROR2, _ERRORS_STARTUPERROR3);
}
}
$bNeedsLogin = false;
$bIsActivation = in_array($action, array('activate', 'activatesetpwd'));
if ($action == 'logout') {
$bNeedsLogin = true;
}
if (!$member->isLoggedIn() && !$bIsActivation) {
$bNeedsLogin = true;
}
// show error if member cannot login to admin
if ($member->isLoggedIn() && !$member->canLogin() && !$bIsActivation) {
$error = _ERROR_LOGINDISALLOWED;
$bNeedsLogin = true;
}
if ($bNeedsLogin) {
setOldAction($action);
// see ADMIN::login() (sets old action in POST vars)
$action = 'showlogin';
}
sendContentType('text/html', 'admin-' . $action);
$admin = new ADMIN();
$admin->action($action);
示例7: sendMedia
/**
* Sends the actual media file
* and possibly resamples it.
*
*
* @author Ben Dodson
* @version 11/11/04
* @since 11/11/04
*/
function sendMedia($path, $name, $resample = false, $download = false)
{
// Let's get the extension from the file
$extArr = explode(".", $path);
$ext = $extArr[count($extArr) - 1];
// Now let's fix up the name
if (substr($name, 0 - strlen($ext) - 1) != "." . $ext) {
$name .= "." . $ext;
}
// First are we resampling?
// If so no header here
if ($resample == "") {
sendContentType($ext);
}
// TODO: resample.
// probably make a different streamFile (streamResampled)
streamFile($path, $name, false, $resample, $download);
}
示例8: forgotPassword
/**
* Sends a new password
*/
function forgotPassword()
{
$membername = trim(postVar('name'));
if (!MEMBER::exists($membername)) {
doError(_ERROR_NOSUCHMEMBER);
}
$mem = MEMBER::createFromName($membername);
/* below keeps regular users from resetting passwords using forgot password feature
Removing for now until clear why it is required.*/
/*if (!$mem->canLogin())
doError(_ERROR_NOLOGON_NOACTIVATE);*/
// check if e-mail address is correct
if (!($mem->getEmail() == postVar('email'))) {
doError(_ERROR_INCORRECTEMAIL);
}
// send activation link
$mem->sendActivationLink('forgot');
if (postVar('url')) {
redirect(postVar('url'));
} else {
// header ("Content-Type: text/html; charset="._CHARSET);
sendContentType('text/html', '', _CHARSET);
echo _MSG_ACTIVATION_SENT;
echo '<br /><br />Return to <a href="' . $CONF['IndexURL'] . '" title="' . $CONF['SiteName'] . '">' . $CONF['SiteName'] . '</a>';
}
exit;
}
示例9: bm_doContextMenuCode
if ($action == 'contextmenucode') {
bm_doContextMenuCode();
exit;
}
if (!$member->isLoggedIn()) {
bm_loginAndPassThrough();
exit;
}
// on successfull login
if ($action == 'login' && $member->isLoggedIn()) {
$action = requestVar('nextaction');
}
if ($action == '') {
$action = 'add';
}
sendContentType('text/html', 'bookmarklet-' . $action);
// check ticket
$action = strtolower($action);
$aActionsNotToCheck = array('login', 'add', 'edit');
if (!in_array($action, $aActionsNotToCheck)) {
if (!$manager->checkTicket()) {
bm_doError(_ERROR_BADTICKET);
}
}
// find out what to do
switch ($action) {
// adds the item for real
case 'additem':
bm_doAddItem();
break;
// shows the edit item form