diff options
author | thomascube <thomas@roundcube.net> | 2008-06-20 11:40:05 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-06-20 11:40:05 +0000 |
commit | fde466c58c004e8f7eff7b59c78f62eef250cde9 (patch) | |
tree | d46360c24b111482b27f0a14a4ab821e3cfd4d7a /program/include | |
parent | 2da368e6633ae4dec5d9b02ec3f4b693ffc9fb76 (diff) |
Urlencode mail recipients for storing in session + little code cleanup
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/main.inc | 13 | ||||
-rw-r--r-- | program/include/rcmail.php | 13 | ||||
-rw-r--r-- | program/include/rcube_json_output.php | 2 |
3 files changed, 10 insertions, 18 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index a29978a5e..d84ca896a 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -128,18 +128,7 @@ function rcmail_overwrite_action($action) function rcmail_url($action, $p=array(), $task=null) { $app = rcmail::get_instance(); - - $qstring = ''; - $base = $app->comm_path; - - if ($task && in_array($task, rcmail::$main_tasks)) - $base = ereg_replace('_task=[a-z]+', '_task='.$task, $app->comm_path); - - if (is_array($p)) - foreach ($p as $key => $val) - $qstring .= '&'.urlencode($key).'='.urlencode($val); - - return $base . ($action ? '&_action='.$action : '') . $qstring; + return $app->url((array)$p + array('_action' => $action, 'task' => $task)); } diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 7c12ef779..c2ad9cf87 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -830,13 +830,16 @@ class rcmail public function url($p) { if (!is_array($p)) - $p = array('action' => @func_get_arg(0)); - - $url = $p['task'] ? './?_task=' . $p['task'] : $this->comm_path; - unset($p['task']); + $p = array('_action' => @func_get_arg(0)); + if ($p['task'] && in_array($p['task'], rcmail::$main_tasks)) + $url = './?_task='.$p['task']; + else + $url = $this->comm_path; + + unset($p['task']); foreach ($p as $par => $val) - $url .= sprintf('&%s=%s', urlencode($par), urlencode($val)); + $url .= '&'.urlencode($par).'='.urlencode($val); return $url; } diff --git a/program/include/rcube_json_output.php b/program/include/rcube_json_output.php index 2f65c19e9..e170445e5 100644 --- a/program/include/rcube_json_output.php +++ b/program/include/rcube_json_output.php @@ -169,7 +169,7 @@ class rcube_json_output * @param mixed Either a string with the action or url parameters as key-value pairs * @see rcmail::url() */ - public function redirect($p = array(), $delay = 0) + public function redirect($p = array(), $delay = 1) { $location = rcmail::get_instance()->url($p); $this->remote_response("window.setTimeout(\"location.href='{$location}'\", $delay);"); |