summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre.alapetite@alexandra.dk> 2015-07-30 23:43:00 +0200
committerGravatar Alexandre Alapetite <alexandre.alapetite@alexandra.dk> 2015-07-30 23:43:00 +0200
commit27b93e9a9f7002ddb4ce30d4a9ee626e44c8037f (patch)
treefce9e030ca193b93c69aaa172ac47c1b22e7c201 /lib
parent2f2facac300b95021406085d5d1701e001a0af65 (diff)
parentf7190c34e1a1ea36bbc81a7dea8dcb7a39cea7cf (diff)
Merge remote-tracking branch 'origin/MinzSessionCookie' into dev
Diffstat (limited to 'lib')
-rw-r--r--lib/Minz/Configuration.php28
-rw-r--r--lib/Minz/Session.php7
2 files changed, 14 insertions, 21 deletions
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php
index ab5bb4fc2..d695d4a53 100644
--- a/lib/Minz/Configuration.php
+++ b/lib/Minz/Configuration.php
@@ -39,7 +39,7 @@ class Minz_Configuration {
throw new Minz_FileNotExistException($filename);
}
- $data = @include($filename);
+ $data = include($filename);
if (is_array($data)) {
return $data;
} else {
@@ -85,11 +85,6 @@ class Minz_Configuration {
private $data = array();
/**
- * The default values, an empty array by default.
- */
- private $data_default = array();
-
- /**
* An object which help to set good values in configuration.
*/
private $configuration_setter = null;
@@ -119,21 +114,22 @@ class Minz_Configuration {
$configuration_setter = null) {
$this->namespace = $namespace;
$this->config_filename = $config_filename;
+ $this->default_filename = $default_filename;
+ $this->_configurationSetter($configuration_setter);
+
+ if (!is_null($this->default_filename)) {
+ $this->data = self::load($this->default_filename);
+ }
try {
- $this->data = self::load($this->config_filename);
+ $this->data = array_replace_recursive(
+ $this->data, self::load($this->config_filename)
+ );
} catch (Minz_FileNotExistException $e) {
- if (is_null($default_filename)) {
+ if (is_null($this->default_filename)) {
throw $e;
}
}
-
- $this->default_filename = $default_filename;
- if (!is_null($this->default_filename)) {
- $this->data_default = self::load($this->default_filename);
- }
-
- $this->_configurationSetter($configuration_setter);
}
/**
@@ -160,8 +156,6 @@ class Minz_Configuration {
return $this->data[$key];
} elseif (!is_null($default)) {
return $default;
- } elseif (isset($this->data_default[$key])) {
- return $this->data_default[$key];
} else {
Minz_Log::warning($key . ' does not exist in configuration');
return null;
diff --git a/lib/Minz/Session.php b/lib/Minz/Session.php
index 058685ada..14a093bf7 100644
--- a/lib/Minz/Session.php
+++ b/lib/Minz/Session.php
@@ -65,10 +65,9 @@ class Minz_Session {
* @param $l la durée de vie
*/
public static function keepCookie($l) {
- // Get the script_name (e.g. /p/i/index.php) and keep only the path.
- $cookie_dir = empty($_SERVER['SCRIPT_NAME']) ? '' : $_SERVER['SCRIPT_NAME'];
- $cookie_dir = dirname($cookie_dir);
- session_set_cookie_params($l, $cookie_dir, '', false, true);
+ // Get the script_name (e.g. /p/i/index.php) and keep only the path.
+ $cookie_dir = dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirname($_SERVER['REQUEST_URI']));
+ session_set_cookie_params($l, $cookie_dir, '', false, false);
}