Add referer tracking for add_email from email and squirrelmail

This commit is contained in:
Miles Lott 2001-04-14 14:58:29 +00:00
parent 144575af05
commit 1e7fc18384
4 changed files with 35 additions and 20 deletions

View File

@ -1,16 +1,16 @@
<?php
/**************************************************************************\
* phpGroupWare - addressbook *
* http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/**************************************************************************\
* phpGroupWare - addressbook *
* http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
/* $Id$ */
if ($submit || $AddVcard) {
$phpgw_info["flags"] = array(
@ -42,7 +42,7 @@
if ($AddVcard){
Header("Location: " . $phpgw->link("/addressbook/vcardin.php"));
} else if ($add_email) {
list($fields["firstname"],$fields["lastname"]) = explode(" ", $name);
list($fields["n_given"],$fields["n_family"]) = explode(" ", $name);
$fields["email"] = $add_email;
addressbook_form("","add.php","Add",$fields,'',$cat_id);
} else if (! $submit && ! $add_email) {
@ -164,9 +164,9 @@
addressbook_add_entry($phpgw_info["user"]["account_id"],$fields,$fields["access"],$fields["cat_id"]);
$ab_id = addressbook_get_lastid();
$referer = urlencode($referer);
Header("Location: "
. $phpgw->link("/addressbook/view.php","ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&cat_id=$cat_id"));
. $phpgw->link("/addressbook/view.php","ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&cat_id=$cat_id&referer=$referer"));
$phpgw->common->phpgw_exit();
}

View File

@ -177,9 +177,9 @@
}
addressbook_update_entry($ab_id,$userid,$fields,$fields['access'],$fields["cat_id"]);
$referer = urlencode($referer);
Header("Location: "
. $phpgw->link("/addressbook/view.php","ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
. $phpgw->link("/addressbook/view.php","ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id&referer=$referer"));
$phpgw->common->phpgw_exit();
}

View File

@ -222,7 +222,7 @@
// Folowing used for add/edit
function addressbook_form($format,$action,$title="",$fields="",$customfields="",$cat_id="")
{
global $phpgw, $phpgw_info;
global $phpgw, $phpgw_info,$referer;
$t = new Template($phpgw->common->get_tpl_dir("addressbook"));
$t->set_file(array( "form" => "form.tpl"));
@ -429,7 +429,7 @@
}
if ($action) {
echo "<FORM action=\"".$phpgw->link('/addressbook/' . $action)."\" method=\"post\">\n";
echo "<FORM action=\"".$phpgw->link('/addressbook/' . $action.'?referer='.urlencode($referer))."\" method=\"post\">\n";
}
if (! ereg("^http://",$url)) {

View File

@ -138,13 +138,28 @@
if (($this->grants[$record_owner] & PHPGW_ACL_EDIT) || ($record_owner == $phpgw_info['user']['account_id']))
{
$t->set_var('edit_link','<form method="POST" action="' . $phpgw->link("/addressbook/edit.php").'">');
if ($referer)
{
$t->set_var('edit_link','<form method="POST" action="' . $phpgw->link("/addressbook/edit.php",'referer='.urlencode($referer)).'">');
}
else
{
$t->set_var('edit_link','<form method="POST" action="' . $phpgw->link("/addressbook/edit.php").'">');
}
$t->set_var('edit_button','<input type="submit" name="edit" value="' . lang('Edit') . '">');
}
$copylink = '<form method="POST" action="' . $phpgw->link("/addressbook/add.php").'">';
$vcardlink = '<form method="POST" action="' . $phpgw->link("/addressbook/vcardout.php").'">';
$donelink = '<form method="POST" action="' . $phpgw->link("/addressbook/index.php").'">';
if ($referer)
{
$referer = ereg_replace('/phpgroupware','',$referer);
$donelink = '<form method="POST" action="' . $phpgw->link($referer).'">';
}
else
{
$donelink = '<form method="POST" action="' . $phpgw->link("/addressbook/index.php").'">';
}
$t->set_var("access_link",$access_link);
$t->set_var("ab_id",$ab_id);