235
235
protected function loadConfig()
237
237
// starts with an empty array which will contain the actual names of the configurations files used
238
$configuration = new PHPDS_array;
238
$configuration = array();
239
239
$configuration['config_files_used'] = array();
240
240
$configuration['config_files_missing'] = array();
300
300
$this->configuration['absolute_url'] = $protocol . $_SERVER['HTTP_HOST'] . str_replace('/index.php', '', $_SERVER['PHP_SELF']);
303
if ($this->embedded) {
304
$this->configuration['session_name'] = session_name();
305
// TODO: deal with empty session
307
if (!empty($this->configuration['absolute_url']))
308
$this->configuration['session_name'] = md5($this->configuration['absolute_url']);
310
if (!empty($this->configuration['session_name']))
311
session_name(md5($this->configuration['session_name']));
312
if (!empty($this->configuration['session_path']))
313
session_save_path($this->configuration['session_path']);
304
if ($this->embedded) {
305
$this->configuration['session_name'] = session_name();
306
// TODO: deal with empty session
308
if (!empty($this->configuration['absolute_url']))
309
$this->configuration['session_name'] = md5($this->configuration['absolute_url']);
311
if (!empty($this->configuration['session_name']))
312
session_name(md5($this->configuration['session_name']));
313
if (!empty($this->configuration['session_path']))
314
session_save_path($this->configuration['session_path']);
317
} catch (Exception $e) {
318
throw new PHPDS_sessionException(session_save_path(), 0, $e);
322
// Make sure we dont keep our session longer then it should be.
323
if (! empty($this->configuration['session_life'])) {
324
if (isset($_SESSION['SYSTEM_SESSION_TIME']) && (time() - $_SESSION['SYSTEM_SESSION_TIME']) > $this->configuration['session_life']) {
325
// Session can now be destroyed.
327
session_regenerate_id(true);
330
$_SESSION['SYSTEM_SESSION_TIME'] = time();
319
// Make sure we dont keep our session longer then it should be.
320
if (! empty($this->configuration['session_life'])) {
321
if (isset($_SESSION['SYSTEM_SESSION_TIME']) && (time() - $_SESSION['SYSTEM_SESSION_TIME']) > $this->configuration['session_life']) {
322
// Session can now be destroyed.
324
session_regenerate_id(true);
327
$_SESSION['SYSTEM_SESSION_TIME'] = time();
330
} catch (Exception $e) {
331
throw new PHPDS_sessionException(session_save_path(), 0, $e);
334
334
return $this; // to allow fluent interface
577
577
public function PHPDS_configuration($configuration = null)
579
if (empty($this->configuration) && is_a($configuration, 'PHPDS_array')) {
579
if (empty($this->configuration) && is_array($configuration)) {
580
580
$this->configuration = new PHPDS_array($configuration);
581
581
$this->configuration['time'] = time();
582
582
//if ($this->compatMode < 2)