| | |
| | | $this->browser = new rcube_browser(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Magic getter |
| | | */ |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Setter for output charset. |
| | | * To be specified in a meta tag and sent as http-header |
| | |
| | | $this->charset = $charset; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for output charset |
| | | * |
| | |
| | | { |
| | | return $this->charset; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set environment variable |
| | |
| | | { |
| | | $this->env[$name] = $value; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Environment variable getter. |
| | |
| | | return $this->env[$name]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Delete all stored env variables and commands |
| | | */ |
| | |
| | | { |
| | | $this->env = array(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Invoke display_message command |
| | |
| | | */ |
| | | abstract function show_message($message, $type = 'notice', $vars = null, $override = true, $timeout = 0); |
| | | |
| | | |
| | | /** |
| | | * Redirect to a certain url. |
| | | * |
| | |
| | | */ |
| | | abstract function redirect($p = array(), $delay = 1); |
| | | |
| | | |
| | | /** |
| | | * Send output to the client. |
| | | */ |
| | | abstract function send(); |
| | | |
| | | |
| | | /** |
| | | * Send HTTP headers to prevent caching a page |
| | |
| | | |
| | | header("Expires: ".gmdate("D, d M Y H:i:s")." GMT"); |
| | | header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
| | | |
| | | // Request browser to disable DNS prefetching (CVE-2010-0464) |
| | | header("X-DNS-Prefetch-Control: off"); |
| | | |
| | | // We need to set the following headers to make downloads work using IE in HTTPS mode. |
| | | if ($this->browser->ie && rcube_utils::https_check()) { |
| | |
| | | */ |
| | | public function future_expire_header($offset = 2600000) |
| | | { |
| | | if (headers_sent()) |
| | | if (headers_sent()) { |
| | | return; |
| | | } |
| | | |
| | | header("Expires: " . gmdate("D, d M Y H:i:s", time()+$offset) . " GMT"); |
| | | header("Cache-Control: max-age=$offset"); |
| | | header("Pragma: "); |
| | | } |
| | | |
| | | /** |
| | | * Send browser compatibility/security/etc. headers |
| | | */ |
| | | public function common_headers() |
| | | { |
| | | if (headers_sent()) { |
| | | return; |
| | | } |
| | | |
| | | // Unlock IE compatibility mode |
| | | if ($this->browser->ie) { |
| | | header('X-UA-Compatible: IE=edge'); |
| | | } |
| | | |
| | | // Request browser to disable DNS prefetching (CVE-2010-0464) |
| | | header("X-DNS-Prefetch-Control: off"); |
| | | } |
| | | |
| | | /** |
| | | * Show error page and terminate script execution |
| | |
| | | fputs(STDERR, "Error $code: $message\n"); |
| | | exit(-1); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create an edit field for inclusion on a form |
| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert a variable into a javascript object notation |
| | | * |
| | |
| | | // that's why we have @ here |
| | | return @json_encode($input); |
| | | } |
| | | |
| | | } |