diff options
author | friendica <info@friendica.com> | 2014-01-18 23:49:39 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-01-18 23:49:39 -0800 |
commit | 724ad4505628d493b43b4f585512d67dc0b4ee76 (patch) | |
tree | 4fb920a79e3dff961a6301ec56ec9f40e91f6af3 /library/ajaxchat/chat/lib/class/AJAXChatHTTPHeader.php | |
parent | 3f7032e542e3c451507fc9266ab3536155c8190f (diff) | |
download | volse-hubzilla-724ad4505628d493b43b4f585512d67dc0b4ee76.tar.gz volse-hubzilla-724ad4505628d493b43b4f585512d67dc0b4ee76.tar.bz2 volse-hubzilla-724ad4505628d493b43b4f585512d67dc0b4ee76.zip |
add ajaxchat library - needs a lot of integration work to handle decentralisation (e.g. chatroom@website) and zotid w/permissions (e.g. ACL controlled chatrooms); we can also rip out a lot of stuff we don't need.
Diffstat (limited to 'library/ajaxchat/chat/lib/class/AJAXChatHTTPHeader.php')
-rw-r--r-- | library/ajaxchat/chat/lib/class/AJAXChatHTTPHeader.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/library/ajaxchat/chat/lib/class/AJAXChatHTTPHeader.php b/library/ajaxchat/chat/lib/class/AJAXChatHTTPHeader.php new file mode 100644 index 000000000..7340bfcf0 --- /dev/null +++ b/library/ajaxchat/chat/lib/class/AJAXChatHTTPHeader.php @@ -0,0 +1,56 @@ +<?php +/* + * @package AJAX_Chat + * @author Sebastian Tschan + * @copyright (c) Sebastian Tschan + * @license Modified MIT License + * @link https://blueimp.net/ajax/ + */ + +// Class to manage HTTP header +class AJAXChatHTTPHeader { + + var $_contentType; + var $_constant; + var $_noCache; + + function __construct($encoding='UTF-8', $contentType=null, $noCache=true) { + if($contentType) { + $this->_contentType = $contentType.'; charset='.$encoding; + $this->_constant = true; + } else { + if(isset($_SERVER['HTTP_ACCEPT']) && (strpos($_SERVER['HTTP_ACCEPT'],'application/xhtml+xml') !== false)) { + $this->_contentType = 'application/xhtml+xml; charset='.$encoding; + } else { + $this->_contentType = 'text/html; charset='.$encoding; + } + $this->_constant = false; + } + $this->_noCache = $noCache; + } + + // Method to send the HTTP header: + function send() { + // Prevent caching: + if($this->_noCache) { + header('Cache-Control: no-cache, must-revalidate'); + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); + } + + // Send the content-type-header: + header('Content-Type: '.$this->_contentType); + + // Send vary header if content-type varies (important for proxy-caches): + if(!$this->_constant) { + header('Vary: Accept'); + } + } + + // Method to return the content-type string: + function getContentType() { + // Return the content-type string: + return $this->_contentType; + } + +} +?>
\ No newline at end of file |