22 if ($_SERVER[
'HTTP_HOST'] ==
"") {
23 print
"\n--Redirect $appname $actionname--\n";
30 if ($otherurl ==
"") {
36 ))) $baseurl =
$action->GetParam(
"CORE_BASEURL");
38 }
else $baseurl = $otherurl;
44 $action->log->debug(
"Redirect : $location");
46 if ($httpparamredirect) {
49 if (is_array($ZONE_ARGS))
foreach ($ZONE_ARGS as $k => $v)
$location.=
"&$k=$v";
55 $trace[
"__url"] = $trace[
"url"];
56 $trace[
"__init"] = $trace[
"init"];
58 unset($trace[
"init"]);
59 $deb = gettimeofday();
61 $trace[
"__app"] = sprintf(
"%.03fs",
$tic4 - $ticainit);
62 $trace[
"__memory"] = sprintf(
"%dkb", round(memory_get_usage() / 1024));
63 $trace[
"__queries"] = sprintf(
"%.03fs #%d", $SQLDELAY, count($TSQLDELAY));
64 $trace[
"__server all"] = sprintf(
"%.03fs",
$tic4 - $tic1);
65 $action->register(
"trace", $trace);
67 if (($_GET[
"viewext"] ==
"yes") || (
$_POST[
"viewext"] ==
"yes")) {
69 if (preg_match(
"/action=GENERIC_EDIT/",
$location)) {
74 Header(
"Location: $location");
82 if ($_SERVER[
"HTTP_REFERER"] !=
"") {
83 Header(
"Location: " . $_SERVER[
"HTTP_REFERER"]);
88 Header(
"Location: " . $referer);
92 $action->exitError(_(
"no referer url found"));
100 if (isset($ZONE_ARGS[
$name]))
return ($ZONE_ARGS[$name]);
101 if (isset($_GET[$name]))
return stripslashes($_GET[$name]);
102 if (isset($_POST[$name])) {
103 if (is_array($_POST[$name]))
return array_map(create_function(
'$v',
'return is_scalar($v)?stripslashes($v):$v;'), $_POST[$name]);
104 else return stripslashes($_POST[$name]);
113 if (isset($_COOKIE[
$name]))
return $_COOKIE[
$name];
121 if ($def ==
"") unset($ZONE_ARGS[
$name]);
122 else $ZONE_ARGS[
$name] = $def;
127 $mimes = file(
"/etc/mime.types");
128 while (list($k, $v) = each($mimes)) {
129 if (substr($v, 0, 1) ==
"#")
continue;
130 $tab = preg_split(
"/\s+/", $v);
131 if ((isset($tab[1])) && ($tab[1] == $ext))
return ($tab[0]);
138 $mimes = file(
"/etc/mime.types");
139 while (list($k, $v) = each($mimes)) {
140 if (substr($v, 0, 1) ==
"#")
continue;
141 $tab = preg_split(
"/\s+/", $v);
142 if ((isset($tab[0])) && ($tab[0] == $mime_type)) {
143 if (isset($tab[1])) {
155 if ($mime_type ==
'') $mime_type =
GetMimeType($ext);
157 header(
"Cache-control: private");
158 header(
'Content-Length: ' . strlen($src));
160 header(
"Content-Disposition: form-data;filename=\"$name\"");
161 header(
"Content-type: " . $mime_type);
168 printf(_(
"file not found : %s") ,
$filename);
175 if (!$inline) header(
"Content-Disposition: attachment;filename=\"$name\"");
176 else header(
"Content-Disposition: inline;filename=\"$name\"");
180 header(
"Cache-Control: private, max-age=$duration");
181 header(
"Expires: " . gmdate(
"D, d M Y H:i:s T\n", time() +
$duration));
184 header(
"Cache-Control: private");
187 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);
189 header(
"Content-type: " . $mime_type);
190 header(
"Content-Transfer-Encoding: binary");
191 header(
"Content-Length: " . filesize(
$filename));
199 printf(_(
"file not found : %s") ,
$filename);
207 if (isset($ZONE_ARGS)) print_r($ZONE_ARGS);
208 if (isset($_GET)) print_r($_GET);
209 if (isset($_POST)) print_r($_POST);
215 if (!is_array($parsed))
return false;
216 $uri = $parsed[
'scheme'] ? $parsed[
'scheme'] .
':' . ((strtolower($parsed[
'scheme']) ==
'mailto') ?
'' :
'//') :
'';
217 $uri.= $parsed[
'user'] ? $parsed[
'user'] . ($parsed[
'pass'] ?
':' . $parsed[
'pass'] :
'') .
'@' :
'';
218 $uri.= $parsed[
'host'] ? $parsed[
'host'] :
'';
219 $uri.= $parsed[
'port'] ?
':' . $parsed[
'port'] :
'';
220 $uri.= $parsed[
'path'] ? $parsed[
'path'] :
'';
221 $uri.= $parsed[
'query'] ?
'?' . $parsed[
'query'] :
'';
222 $uri.= $parsed[
'fragment'] ?
'#' . $parsed[
'fragment'] :
'';
230 ini_set(
'session.cache_limiter',
'none');
232 header(
"Cache-Control: private, max-age=$duration");
233 header(
"Expires: " . gmdate(
"D, d M Y H:i:s T\n", time() +
$duration));
234 header(
"Pragma: none");
235 header(
"Content-type: $mime");