2022-05-10 18:46:12 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2022-05-11 15:51:26 +02:00
|
|
|
* API: loading styles for TinyMCE incl. users preferred font and -size
|
2022-05-10 18:46:12 +02:00
|
|
|
*
|
|
|
|
* @link www.egroupware.org
|
2022-05-11 15:51:26 +02:00
|
|
|
* @author Ralf Becker <rb-at-egroupware.org>
|
2022-05-10 18:46:12 +02:00
|
|
|
* @package api
|
2022-05-11 15:51:26 +02:00
|
|
|
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
2022-05-10 18:46:12 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
use EGroupware\Api;
|
|
|
|
|
2022-05-11 15:51:26 +02:00
|
|
|
// switch evtl. set output-compression off, as we can't calculate a Content-Length header with transparent compression
|
2022-05-10 18:46:12 +02:00
|
|
|
ini_set('zlib.output_compression', 0);
|
|
|
|
|
|
|
|
$GLOBALS['egw_info'] = array(
|
|
|
|
'flags' => array(
|
|
|
|
'currentapp' => 'api',
|
|
|
|
'noheader' => true,
|
|
|
|
'nocachecontrol' => true,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
include '../header.inc.php';
|
|
|
|
|
|
|
|
// release session, as we don't need it, and it blocks parallel requests
|
|
|
|
$GLOBALS['egw']->session->commit_session();
|
|
|
|
|
2022-05-11 15:51:26 +02:00
|
|
|
// use an etag over user prefs and modification time of HtmlArea
|
|
|
|
$etag = '"'.md5(json_encode(array_intersect_key($GLOBALS['egw_info']['user']['preferences']['common'],
|
2022-05-23 12:48:30 +02:00
|
|
|
array_flip(['rte_font', 'rte_font_size', 'rte_font_unit']))).filemtime(__DIR__.'/src/Etemplate/Widget/HtmlArea.php')).'"';
|
2022-05-10 18:46:12 +02:00
|
|
|
|
|
|
|
// headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
|
|
|
|
Api\Session::cache_control(86400); // cache for 1 day
|
|
|
|
Header('Content-Type: text/css');
|
|
|
|
Header('ETag: '.$etag);
|
|
|
|
|
|
|
|
// if servers send a If-None-Match header, response with 304 Not Modified, if etag matches
|
|
|
|
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] === $etag)
|
|
|
|
{
|
|
|
|
header("HTTP/1.1 304 Not Modified");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2022-05-11 15:51:26 +02:00
|
|
|
$content = Api\Etemplate\Widget\HtmlArea::contentCss();
|
|
|
|
|
2022-05-10 18:46:12 +02:00
|
|
|
// we run our own gzip compression, to set a correct Content-Length of the encoded content
|
|
|
|
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
|
|
|
|
{
|
|
|
|
$content = gzencode($content);
|
|
|
|
header('Content-Encoding: gzip');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Content-Lenght header is important, otherwise browsers dont cache!
|
|
|
|
Header('Content-Length: '.bytes($content));
|
|
|
|
echo $content;
|