summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-11-15 09:34:08 +0100
committerAleksander Machniak <alec@alec.pl>2012-11-15 09:34:08 +0100
commit8d54286df87e21673c05f091e38ca4de14aae326 (patch)
treed60c6d6765f5beafe4966352ebbd52e4c9c9661b /program/include
parent82d875769cade12b82aeab6723c869d87fb7a4c9 (diff)
parentf226549d4f8f258deca9e165ef857252b79d2ee0 (diff)
Merge branch 'keep-alive'
Conflicts: CHANGELOG
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcmail.php16
-rw-r--r--program/include/rcube.php30
-rw-r--r--program/include/rcube_config.php2
-rw-r--r--program/include/rcube_plugin_api.php2
-rw-r--r--program/include/rcube_session.php20
5 files changed, 14 insertions, 56 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 3728e5d19..99a68e81d 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -94,9 +94,6 @@ class rcmail extends rcube
// create user object
$this->set_user(new rcube_user($_SESSION['user_id']));
- // configure session (after user config merge!)
- $this->session_configure();
-
// set task and action properties
$this->set_task(rcube_utils::get_input_value('_task', rcube_utils::INPUT_GPC));
$this->action = asciiwords(rcube_utils::get_input_value('_action', rcube_utils::INPUT_GPC));
@@ -320,10 +317,9 @@ class rcmail extends rcube
if (!($this->output instanceof rcube_output_html))
$this->output = new rcube_output_html($this->task, $framed);
- // set keep-alive/check-recent interval
- if ($this->session && ($keep_alive = $this->session->get_keep_alive())) {
- $this->output->set_env('keep_alive', $keep_alive);
- }
+ // set refresh interval
+ $this->output->set_env('refresh_interval', $this->config->get('refresh_interval', 0));
+ $this->output->set_env('session_lifetime', $this->config->get('session_lifetime', 0) * 60);
if ($framed) {
$this->comm_path .= '&_framed=1';
@@ -336,7 +332,7 @@ class rcmail extends rcube
$this->output->set_charset(RCMAIL_CHARSET);
// add some basic labels to client
- $this->output->add_label('loading', 'servererror', 'requesttimedout');
+ $this->output->add_label('loading', 'servererror', 'requesttimedout', 'refreshing');
return $this->output;
}
@@ -522,7 +518,6 @@ class rcmail extends rcube
// Configure environment
$this->set_user($user);
$this->set_storage_prop();
- $this->session_configure();
// fix some old settings according to namespace prefix
$this->fix_namespace_settings($user);
@@ -775,6 +770,7 @@ class rcmail extends rcube
}
}
+
/**
* Registers action aliases for current task
*
@@ -789,6 +785,7 @@ class rcmail extends rcube
}
}
+
/**
* Returns current action filename
*
@@ -803,6 +800,7 @@ class rcmail extends rcube
return strtr($this->action, '-', '_') . '.inc';
}
+
/**
* Fixes some user preferences according to namespace handling change.
* Old Roundcube versions were using folder names with removed namespace prefix.
diff --git a/program/include/rcube.php b/program/include/rcube.php
index 0e40b3c6b..9c1a6d84a 100644
--- a/program/include/rcube.php
+++ b/program/include/rcube.php
@@ -434,6 +434,9 @@ class rcube
$this->session->register_gc_handler(array($this, 'temp_gc'));
$this->session->register_gc_handler(array($this, 'cache_gc'));
+ $this->session->set_secret($this->config->get('des_key') . dirname($_SERVER['SCRIPT_NAME']));
+ $this->session->set_ip_check($this->config->get('ip_check'));
+
// start PHP session (if not in CLI mode)
if ($_SERVER['REMOTE_ADDR']) {
session_start();
@@ -442,33 +445,6 @@ class rcube
/**
- * Configure session object internals
- */
- public function session_configure()
- {
- if (!$this->session) {
- return;
- }
-
- $lifetime = $this->config->get('session_lifetime', 0) * 60;
- $keep_alive = $this->config->get('keep_alive');
-
- // set keep-alive/check-recent interval
- if ($keep_alive) {
- // be sure that it's less than session lifetime
- if ($lifetime) {
- $keep_alive = min($keep_alive, $lifetime - 30);
- }
- $keep_alive = max(60, $keep_alive);
- $this->session->set_keep_alive($keep_alive);
- }
-
- $this->session->set_secret($this->config->get('des_key') . dirname($_SERVER['SCRIPT_NAME']));
- $this->session->set_ip_check($this->config->get('ip_check'));
- }
-
-
- /**
* Garbage collector function for temp files.
* Remove temp files older than two days
*/
diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php
index 1f165ba4a..bbc3e9c6e 100644
--- a/program/include/rcube_config.php
+++ b/program/include/rcube_config.php
@@ -43,6 +43,8 @@ class rcube_config
'mail_pagesize' => 'pagesize',
'addressbook_pagesize' => 'pagesize',
'reply_mode' => 'top_posting',
+ 'refresh_interval' => 'keep_alive',
+ 'min_refresh_interval' => 'min_keep_alive',
);
diff --git a/program/include/rcube_plugin_api.php b/program/include/rcube_plugin_api.php
index 107c81026..c473b0b17 100644
--- a/program/include/rcube_plugin_api.php
+++ b/program/include/rcube_plugin_api.php
@@ -327,7 +327,7 @@ class rcube_plugin_api
if (isset($this->actions[$action])) {
call_user_func($this->actions[$action]);
}
- else {
+ else if (rcube::get_instance()->action != 'refresh') {
rcube::raise_error(array('code' => 524, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
'message' => "No handler found for action $action"), true, true);
diff --git a/program/include/rcube_session.php b/program/include/rcube_session.php
index 6192466cd..c71efa2aa 100644
--- a/program/include/rcube_session.php
+++ b/program/include/rcube_session.php
@@ -43,7 +43,6 @@ class rcube_session
private $secret = '';
private $ip_check = false;
private $logging = false;
- private $keep_alive = 0;
private $memcache;
/**
@@ -525,24 +524,6 @@ class rcube_session
$this->now = $now - ($now % ($this->lifetime / 2));
}
- /**
- * Setter for keep_alive interval
- */
- public function set_keep_alive($keep_alive)
- {
- $this->keep_alive = $keep_alive;
-
- if ($this->lifetime < $keep_alive)
- $this->set_lifetime($keep_alive + 30);
- }
-
- /**
- * Getter for keep_alive interval
- */
- public function get_keep_alive()
- {
- return $this->keep_alive;
- }
/**
* Getter for remote IP saved with this session
@@ -552,6 +533,7 @@ class rcube_session
return $this->ip;
}
+
/**
* Setter for cookie encryption secret
*/