24 if (empty($_SERVER[
'HTTP_HOST'])) {
25 print "\n--Redirect $appname $actionname--\n";
32 if ($otherurl ==
"") {
38 ))) $baseurl =
$action->GetParam(
"CORE_BASEURL");
40 }
else $baseurl = $otherurl;
46 $action->log->debug(
"Redirect : $location");
48 if ($httpparamredirect) {
51 if (is_array($ZONE_ARGS))
foreach ($ZONE_ARGS as $k => $v)
$location.=
"&$k=$v";
57 $trace[
"__url"] = $trace[
"url"];
58 $trace[
"__init"] = $trace[
"init"];
60 unset($trace[
"init"]);
61 $deb = gettimeofday();
63 $trace[
"__app"] = sprintf(
"%.03fs",
$tic4 - $ticainit);
64 $trace[
"__memory"] = sprintf(
"%dkb", round(memory_get_usage() / 1024));
65 $trace[
"__queries"] = sprintf(
"%.03fs #%d", $SQLDELAY, count($TSQLDELAY));
66 $trace[
"__server all"] = sprintf(
"%.03fs",
$tic4 - $tic1);
67 $action->register(
"trace", $trace);
69 $viewext = isset($_GET[
"viewext"]) ? $_GET[
"viewext"] : (isset(
$_POST[
"viewext"]) ?
$_POST[
"viewext"] :
"");
70 if ($viewext ===
"yes") {
71 if (\Dcp\Autoloader::classExists(
"Dcp\\ExtUi\\defaultMenu")) {
77 header(
"Location: $location");
85 if ($_SERVER[
"HTTP_REFERER"] !=
"") {
86 Header(
"Location: " . $_SERVER[
"HTTP_REFERER"]);
89 $referer = GetHttpVars(
"http_referer");
91 Header(
"Location: " . $referer);
95 $action->
exitError(_(
"no referer url found"));
128 if (($scope ==
"all" || $scope ==
"zone") && isset($ZONE_ARGS[$name])) {
130 return ($ZONE_ARGS[$name]);
132 if (($scope ==
"all" || $scope ==
"get") && isset($_GET[$name])) {
135 if (($scope ==
"all" || $scope ==
"post") && isset($_POST[$name])) {
136 return $_POST[$name];
146 if (isset($_COOKIE[$name]))
return $_COOKIE[$name];
154 if ($def ==
"") unset($ZONE_ARGS[$name]);
155 else $ZONE_ARGS[$name] = $def;
160 $mimes = file(
"/etc/mime.types");
161 foreach ($mimes as $v) {
162 if (substr($v, 0, 1) ==
"#")
continue;
163 $tab = preg_split(
'/\s+/', $v);
164 if ((isset($tab[1])) && ($tab[1] ==
$ext))
return ($tab[0]);
171 $mimes = file(
"/etc/mime.types");
172 foreach ($mimes as $v) {
173 if (substr($v, 0, 1) ==
"#")
continue;
174 $tab = preg_split(
'\s+/', $v);
175 if ((isset($tab[0])) && ($tab[0] == $mime_type)) {
176 if (isset($tab[1])) {
200 if ($add_ext) $name = $name .
"." .
$ext;
201 $name = str_replace(
'"',
'\\"', $name);
202 $uName = iconv(
"UTF-8",
"ASCII//TRANSLIT", $name);
203 $name = rawurlencode($name);
204 header(
"Cache-control: private");
205 header(
'Content-Length: ' . strlen($src));
207 header(
"Content-Disposition: attachment;filename=\"$uName\";filename*=UTF-8''$name;");
208 header(
"Content-type: " . $mime_type);
209 header(
"X-Content-Type-Options: nosniff");
227 require_once
'FDL/Class.FileMimeConfig.php';
230 printf(_(
"file not found : %s") ,
$filename);
234 if (php_sapi_name() !==
'cli') {
236 $name = str_replace(
'"',
'-', $name);
237 $uName = iconv(
"UTF-8",
"ASCII//TRANSLIT", $name);
238 $name = rawurlencode($name);
239 $fileMimeConfig = new \Dcp\FileMimeConfig();
240 if ($inline && !$fileMimeConfig->isInlineAllowed($mime_type)) {
245 header(
"Content-Disposition: attachment;filename=\"$uName\";filename*=UTF-8''$name;");
247 header(
"Content-Disposition: inline;filename=\"$uName\";filename*=UTF-8''$name;");
252 header(
"Cache-Control: private, max-age=$duration");
253 header(
"Expires: " . gmdate(
"D, d M Y H:i:s T\n", time() +
$duration));
256 header(
"Cache-Control: private");
259 if ($inline && substr($mime_type, 0, 4) ==
"text" && substr($mime_type, 0, 9) !=
"text/html" && substr($mime_type, 0, 8) !=
"text/xml") $mime_type = preg_replace(
"_text/([^;]*)_",
"text/plain", $mime_type);
261 header(
"Content-type: " . $mime_type);
262 header(
"X-Content-Type-Options: nosniff");
263 header(
"Content-Transfer-Encoding: binary");
264 header(
"Content-Length: " . filesize(
$filename));
265 $buflen = ob_get_length();
266 if ($buflen !==
false && $buflen > 0) {
280 if (isset($ZONE_ARGS)) print_r($ZONE_ARGS);
281 if (isset($_GET)) print_r($_GET);
282 if (isset($_POST)) print_r($_POST);
288 if (!is_array($parsed))
return false;
289 $uri = $parsed[
'scheme'] ? $parsed[
'scheme'] .
':' . ((strtolower($parsed[
'scheme']) ==
'mailto') ?
'' :
'//') :
'';
290 $uri.= $parsed[
'user'] ? $parsed[
'user'] . ($parsed[
'pass'] ?
':' . $parsed[
'pass'] :
'') .
'@' :
'';
291 $uri.= $parsed[
'host'] ? $parsed[
'host'] :
'';
292 $uri.= $parsed[
'port'] ?
':' . $parsed[
'port'] :
'';
293 $uri.= $parsed[
'path'] ? $parsed[
'path'] :
'';
294 $uri.= $parsed[
'query'] ?
'?' . $parsed[
'query'] :
'';
295 $uri.= $parsed[
'fragment'] ?
'#' . $parsed[
'fragment'] :
'';
304 ini_set(
'session.cache_limiter',
'none');
306 header(
"Cache-Control: private, max-age=$duration");
307 header(
"Expires: " . gmdate(
"D, d M Y H:i:s T\n", time() +
$duration));
308 header(
"Pragma: none");
309 header(
"Content-type: $mime");
310 header(
"X-Content-Type-Options: nosniff");
getDbAccessValue($varName)
if($dbaccess=="") $duration
setHeaderCache($mime="text/css")
RedirectSender(Action &$action)
if(ActionRouter::inMaintenance()) $auth
redirectAsGuest(Action &$action)
Redirect($action, $appname, $actionname, $otherurl="", $httpparamredirect=false)
exitError($texterr, $exit=true, $code="")
Http_Download($src, $ext, $name, $add_ext=TRUE, $mime_type="")
getHttpVars($name, $def="", $scope="all")
Http_DownloadFile($filename, $name, $mime_type= '', $inline=false, $cache=true, $deleteafter=false)
GetHttpCookie($name, $def="")