summaryrefslogtreecommitdiffstats
path: root/application/libraries/MY_Session.php
blob: 0443bca318cb3955ccb36b281f5c2c2aa8bc5d34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*
 * Copyright 2013 Florian "Bluewind" Pritz <bluewind@server-speed.net>
 *
 * Licensed under AGPLv3
 * (see COPYING for full license text)
 *
 */

class MY_Session extends CI_Session {
	private $memory_only = false;

	public function __construct() {
		$CI =& get_instance();
		$CI->load->helper("filebin");

		/* Clients using API keys do not need a persistent session since API keys
		 * should be sent with each request. This reduces database queries and
		 * prevents us from sending useless cookies.
		 */
		if (!stateful_client()) {
			$this->memory_only = true;
			$CI->config->set_item("sess_use_database", false);
		}

		parent::__construct();
	}

	public function _set_cookie($cookie_data = NULL)
	{
		if ($this->memory_only) {
			return;
		}

		parent::_set_cookie($cookie_data);

	}
}