HttpResponse.addCookie ( cookieName,
cookieValue,
encrypted = false,
expires = null 
)

Adds a cookie to the response.

Parameters:
$cookieName Cookie's name
$cookieValue Value to store in the cookie
$encrypted Do some extra encryption on the value
$expires Timestamp of expiration (default: configured)
Returns:
void
Exceptions:
ResponseHeadersAlreadySentException If headers are already sent
Todo:
Encryption of cookie data not yet supported.
Todo:
Why are these parameters conflicting?
Todo:
If the return statement is removed and setcookie() commented out,
Todo:
this will send only one cookie out, the first one.

Definition at line 82 of file class_HttpResponse.php.

References BaseFrameworkSystem.getConfigInstance().

Referenced by expireCookie(), and refreshCookie().

00082                                                                                                    {
00083                 //* DEBUG: */ echo $cookieName."=".$cookieValue."<br />\n";
00084                 // Are headers already sent?
00085                 if (headers_sent()) {
00086                         // Throw an exception here
00087                         //* DEBUG: */ return;
00088                         throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
00089                 } // END - if
00090 
00091                 // Shall we encrypt the cookie?
00092                 if ($encrypted === true) {
00093                 } // END - if
00094 
00095                 // For slow browsers set the cookie array element first
00096                 $_COOKIE[$cookieName] = $cookieValue;
00097 
00098                 // Get all config entries
00099                 if (is_null($expires)) {
00100                         $expires = (time() + $this->getConfigInstance()->readConfig('cookie_expire'));
00101                 } // END - if
00102 
00103                 $path = $this->getConfigInstance()->readConfig('cookie_path');
00104                 $domain = $this->getConfigInstance()->readConfig('cookie_domain');
00105 
00106                 setcookie($cookieName, $cookieValue, $expires);
00107                 //, $path, $domain, (isset($_SERVER['HTTPS']))
00108                 return;
00109 
00110                 // Now construct the full header
00111                 $cookieString = $cookieName . "=" . $cookieValue . "; ";
00112                 $cookieString .= "expires=" . date("D, d-F-Y H:i:s", $expires) . " GMT";
00113                 // $cookieString .= "; path=".$path."; domain=".$domain;
00114 
00115                 // Set the cookie as a header
00116                 $this->cookies[$cookieName] = $cookieString;
00117         }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Mon Dec 8 01:13:04 2008 for Ship-Simulator by  doxygen 1.5.6