ImageResponse.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 98 of file class_ImageResponse.php.

References BaseFrameworkSystem.getConfigInstance().

Referenced by expireCookie(), and refreshCookie().

00098                                                                                                    {
00099                 // Are headers already sent?
00100                 if (headers_sent()) {
00101                         // Throw an exception here
00102                         throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
00103                 } // END - if
00104 
00105                 // Shall we encrypt the cookie?
00106                 if ($encrypted === true) {
00107                 } // END - if
00108 
00109                 // For slow browsers set the cookie array element first
00110                 $_COOKIE[$cookieName] = $cookieValue;
00111 
00112                 // Get all config entries
00113                 if (is_null($expires)) {
00114                         $expires = (time() + $this->getConfigInstance()->readConfig('cookie_expire'));
00115                 } // END - if
00116 
00117                 $path = $this->getConfigInstance()->readConfig('cookie_path');
00118                 $domain = $this->getConfigInstance()->readConfig('cookie_domain');
00119 
00120                 setcookie($cookieName, $cookieValue, $expires);
00121                 //, $path, $domain, (isset($_SERVER['HTTPS']))
00122                 return;
00123 
00124                 // Now construct the full header
00125                 $cookieString = $cookieName . "=" . $cookieValue . "; ";
00126                 $cookieString .= "expires=" . date("D, d-F-Y H:i:s", $expires) . " GMT";
00127                 // $cookieString .= "; path=".$path."; domain=".$domain;
00128 
00129                 // Set the cookie as a header
00130                 $this->cookies[$cookieName] = $cookieString;
00131         }

Here is the call graph for this function:

Here is the caller graph for this function:


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