Urlencode mail recipients for storing in session + little code cleanup

release-0.6
thomascube 17 years ago
parent 2da368e663
commit fde466c58c

@ -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));
}

@ -830,13 +830,16 @@ class rcmail
public function url($p)
{
if (!is_array($p))
$p = array('action' => @func_get_arg(0));
$p = array('_action' => @func_get_arg(0));
$url = $p['task'] ? './?_task=' . $p['task'] : $this->comm_path;
unset($p['task']);
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;
}

@ -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);");

@ -37,8 +37,8 @@ if (!empty($mailto))
{
$mailto_str = join(', ', $mailto);
$mailto_id = substr(md5($mailto_str), 0, 16);
$_SESSION['mailto'][$mailto_id] = $mailto_str;
$OUTPUT->command('redirect', rcmail_url('compose', array('_mailto' => $mailto_id), 'mail'));
$_SESSION['mailto'][$mailto_id] = urlencode($mailto_str);
$OUTPUT->redirect(array('task' => 'mail', '_action' => 'compose', '_mailto' => $mailto_id));
}
else
$OUTPUT->show_message('nocontactsfound', 'warning');

@ -135,7 +135,7 @@ function rcmail_compose_headers($attrib)
// we have a set of recipients stored is session
if (($mailto_id = $_SESSION['compose']['param']['_mailto']) && $_SESSION['mailto'][$mailto_id])
$fvalue = $_SESSION['mailto'][$mailto_id];
$fvalue = urldecode($_SESSION['mailto'][$mailto_id]);
else if (!empty($_SESSION['compose']['param']['_to']))
$fvalue = $_SESSION['compose']['param']['_to'];

Loading…
Cancel
Save