  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: session.php 1668 2007-07-20 14:53:24Z hpdl $ |
| |
| 3 | + | $Id: session.php 1673 2007-08-09 14:25:34Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
72 | 72 | | |
| |
73 | 73 | | public function __construct($name = null) { |
| |
74 | 74 | | $this->setName($name); |
  |
75 | | - | $this->_setCookieParameters(SERVICE_SESSION_EXPIRATION_TIME); |
| |
| 75 | + | $this->setCookieParameters(); |
|
76 | 76 | | |
| |
77 | 77 | | if ( SERVICE_SESSION_EXPIRATION_TIME > 0 ) { |
| |
78 | 78 | | ini_set('session.gc_maxlifetime', SERVICE_SESSION_EXPIRATION_TIME * 60); |
| |
|
|
 |
… |
|
250 | 250 | | /** |
| |
251 | 251 | | * Sets the name of the session |
| |
252 | 252 | | * |
  |
| 253 | + | * @param string $name The name of the session |
|
253 | 254 | | * @access public |
| |
254 | 255 | | */ |
| |
255 | 256 | | |
| |
|
|
 |
… |
|
266 | 267 | | /** |
| |
267 | 268 | | * Sets the storage location for the file based storage handler |
| |
268 | 269 | | * |
  |
| 270 | + | * @param string $path The file path to store the session data in |
|
269 | 271 | | * @access public |
| |
270 | 272 | | */ |
| |
271 | 273 | | |
| |
|
|
 |
… |
|
282 | 284 | | /** |
| |
283 | 285 | | * Sets the cookie parameters for the session (lifetime, path, domain, secure, httponly) |
| |
284 | 286 | | * |
  |
285 | | - | * @access protected |
| |
| 287 | + | * @param integer $lifetime The amount of minutes to keep a cookie active for |
| |
| 288 | + | * @param string $path The web path of the online store to limit cookies to |
| |
| 289 | + | * @param string $domain The domain of the online store to limit cookies to |
| |
| 290 | + | * @param boolean $secure Only access cookies over a secure HTTPS connection |
| |
| 291 | + | * @param boolean $httponly Only access cookies over a HTTP protocol (disallows javascript access to cookies) |
| |
| 292 | + | * @access public |
|
286 | 293 | | */ |
| |
287 | 294 | | |
  |
288 | | - | protected function _setCookieParameters($lifetime = 0, $path = null, $domain = null, $secure = false, $httponly = false) { |
| |
| 295 | + | public function setCookieParameters($lifetime = null, $path = null, $domain = null, $secure = false, $httponly = false) { |
|
289 | 296 | | global $request_type; |
| |
290 | 297 | | |
| |
291 | 298 | | if ( !is_numeric($lifetime) ) { |
  |
292 | | - | $lifetime = 0; |
| |
| 299 | + | $lifetime = SERVICE_SESSION_EXPIRATION_TIME * 60; |
|
293 | 300 | | } |
| |
294 | 301 | | |
| |
295 | 302 | | if ( empty($path) ) { |
| |
|
|
 |
… |
|
306 | 313 | | /** |
| |
307 | 314 | | * Returns the cookie parameters for the session (lifetime, path, domain, secure, httponly) |
| |
308 | 315 | | * |
  |
| 316 | + | * @param string $key If specified, return only the value of this cookie parameter setting |
|
309 | 317 | | * @access public |
| |
310 | 318 | | */ |
| |
311 | 319 | | |
| |
|
|
 |
… |
|
314 | 322 | | $this->_cookie_parameters = session_get_cookie_params(); |
| |
315 | 323 | | } |
| |
316 | 324 | | |
  |
317 | | - | if ( !empty($key) && isset($this->_cookie_parameters[$key]) ) { |
| |
| 325 | + | if ( !empty($key) ) { |
|
318 | 326 | | return $this->_cookie_parameters[$key]; |
  |
319 | | - | } else { |
| |
320 | | - | return false; |
  |
321 | 327 | | } |
| |
322 | 328 | | |
| |
323 | 329 | | return $this->_cookie_parameters; |