Clean up a lot of GET/POST nonsense, moving to POST where possible

This commit is contained in:
Miles Lott 2001-03-29 10:45:29 +00:00
parent 7be7aa0595
commit 36d417cbaa
11 changed files with 75 additions and 41 deletions

View File

@ -164,7 +164,7 @@
$t->set_var("lang_ok",lang("ok")); $t->set_var("lang_ok",lang("ok"));
$t->set_var("lang_clear",lang("clear")); $t->set_var("lang_clear",lang("clear"));
$t->set_var("lang_cancel",lang("cancel")); $t->set_var("lang_cancel",lang("cancel"));
$t->set_var("cancel_url",$phpgw->link("/addressbook/index.php","sort=$sort&order=$order&filter=$filter&start=$start&cat_id=$cat_id")); $t->set_var("cancel_url",$phpgw->link("/addressbook/index.php"));
$t->parse("out","add"); $t->parse("out","add");
$t->pparse("out","add"); $t->pparse("out","add");

View File

@ -32,7 +32,7 @@
if (! $this->check_perms($this->grants[$fields[0]['owner']],PHPGW_ACL_DELETE) && $fields[0]['owner'] != $phpgw_info['user']['account_id']) if (! $this->check_perms($this->grants[$fields[0]['owner']],PHPGW_ACL_DELETE) && $fields[0]['owner'] != $phpgw_info['user']['account_id'])
{ {
Header('Location: ' Header('Location: '
. $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); . $phpgw->link('/addressbook/index.php',"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&ncat_id=$cat_id"));
$phpgw->common->phpgw_exit(); $phpgw->common->phpgw_exit();
} }
@ -45,7 +45,7 @@
$t->set_var(lang_sure,lang("Are you sure you want to delete this entry ?")); $t->set_var(lang_sure,lang("Are you sure you want to delete this entry ?"));
$t->set_var(no_link,$phpgw->link("/addressbook/index.php", $t->set_var(no_link,$phpgw->link("/addressbook/index.php",
"ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); "ab_id=$ab_id&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&ncat_id=$cat_id"));
$t->set_var(lang_no,lang("NO")); $t->set_var(lang_no,lang("NO"));
$t->set_var(yes_link,$phpgw->link("/addressbook/delete.php", $t->set_var(yes_link,$phpgw->link("/addressbook/delete.php",
"ab_id=$ab_id&confirm=true&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); "ab_id=$ab_id&confirm=true&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
@ -57,6 +57,6 @@
$this->account_id=$phpgw_info["user"]["account_id"]; $this->account_id=$phpgw_info["user"]["account_id"];
$this->delete($ab_id); $this->delete($ab_id);
@Header("Location: " . $phpgw->link("/addressbook/index.php", @Header("Location: " . $phpgw->link("/addressbook/index.php",
"cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); "cd=16&order=$order&sort=$sort&filter=$filter&start=$start&query=$query&ncat_id=$cat_id"));
} }
?> ?>

View File

@ -180,12 +180,11 @@
$t->set_var("lang_clear",lang("clear")); $t->set_var("lang_clear",lang("clear"));
$t->set_var("lang_cancel",lang("cancel")); $t->set_var("lang_cancel",lang("cancel"));
$t->set_var("lang_submit",lang("submit")); $t->set_var("lang_submit",lang("submit"));
$t->set_var("cancel_link",'<form method="POST" action="' $t->set_var("cancel_link",'<form method="POST" action="' . $phpgw->link("/addressbook/index.php") . '">');
. $phpgw->link("/addressbook/index.php","sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id") . '">');
if ($this->grants[$check[0]['owner']] & PHPGW_ACL_DELETE || $check[0]['owner'] == $phpgw_info['user']['account_id']) if (($this->grants[$check[0]['owner']] & PHPGW_ACL_DELETE) || $check[0]['owner'] == $phpgw_info['user']['account_id'])
{ {
$t->set_var('delete_link','<form method="POST" action="'.$phpgw->link("/addressbook/delete.php","ab_id=$ab_id") . '">'); $t->set_var('delete_link','<form method="POST" action="'.$phpgw->link("/addressbook/delete.php") . '">');
$t->set_var('delete_button','<input type="submit" name="delete" value="' . lang('Delete') . '">'); $t->set_var('delete_button','<input type="submit" name="delete" value="' . lang('Delete') . '">');
} }

View File

@ -34,7 +34,7 @@
} }
// Return a select form element with the categories option dialog in it // Return a select form element with the categories option dialog in it
function cat_option($cat_id='',$name='cat_id',$notall=False,$java=True) { function cat_option($cat_id='',$name='ncat_id',$notall=False,$java=False) {
global $phpgw_info; global $phpgw_info;
if ($java) { if ($java) {
$jselect = " onChange=\"this.form.submit();\""; $jselect = " onChange=\"this.form.submit();\"";
@ -264,7 +264,7 @@
$cat_id = $fields["cat_id"]; $cat_id = $fields["cat_id"];
} }
$cats_link = cat_option($cat_id,'ncat_id',True,False); $cats_link = cat_option($cat_id,'ncat_id',True);
if ($access == 'private') { if ($access == 'private') {
$access_check = ' checked'; $access_check = ' checked';

View File

@ -44,6 +44,9 @@
if ($cat_id=='') { if ($cat_id=='') {
$cat_id = $phpgw_info["user"]["preferences"]["addressbook"]["default_category"]; $cat_id = $phpgw_info["user"]["preferences"]["addressbook"]["default_category"];
} }
if($ncat_id || ($ncat_id==0)) {
$cat_id = $ncat_id;
}
if ($phpgw_info["user"]["preferences"]["addressbook"]["autosave_category"]) { if ($phpgw_info["user"]["preferences"]["addressbook"]["autosave_category"]) {
$phpgw->preferences->delete("addressbook","default_category"); $phpgw->preferences->delete("addressbook","default_category");
@ -184,22 +187,21 @@
$t->set_var(lang_showing,$lang_showing); $t->set_var(lang_showing,$lang_showing);
$t->set_var(search_filter,$search_filter); $t->set_var(search_filter,$search_filter);
$t->set_var(cats,lang('Category')); $t->set_var(cats,lang('Category'));
$t->set_var(cats_url,$phpgw->link("/addressbook/index.php", $t->set_var(cats_url,$phpgw->link("/addressbook/index.php"));
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id")); $t->set_var(cats_link,cat_option($cat_id));
$t->set_var(cats_link,cat_option($cat_id,'cat_id',False,False));
$t->set_var(lang_cats,lang('Select')); $t->set_var(lang_cats,lang('Select'));
$t->set_var("lang_addressbook",lang("Address book")); $t->set_var("lang_addressbook",lang("Address book"));
$t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); $t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
$t->set_var("th_font",$phpgw_info["theme"]["font"]); $t->set_var("th_font",$phpgw_info["theme"]["font"]);
$t->set_var("th_text",$phpgw_info["theme"]["th_text"]); $t->set_var("th_text",$phpgw_info["theme"]["th_text"]);
$t->set_var("lang_add",lang("Add")); $t->set_var("lang_add",lang("Add"));
$t->set_var("add_url",$phpgw->link("/addressbook/add.php"));
$t->set_var("lang_addvcard",lang("AddVCard")); $t->set_var("lang_addvcard",lang("AddVCard"));
$t->set_var("vcard_url",$phpgw->link("/addressbook/vcardin.php"));
$t->set_var("lang_import",lang("Import Contacts")); $t->set_var("lang_import",lang("Import Contacts"));
$t->set_var("import_url",$phpgw->link("/addressbook/import.php", $t->set_var("import_url",$phpgw->link("/addressbook/import.php"));
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
$t->set_var("lang_export",lang("Export Contacts")); $t->set_var("lang_export",lang("Export Contacts"));
$t->set_var("export_url",$phpgw->link("/addressbook/export.php", $t->set_var("export_url",$phpgw->link("/addressbook/export.php"));
"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id"));
$t->set_var("start",$start); $t->set_var("start",$start);
$t->set_var("sort",$sort); $t->set_var("sort",$sort);
$t->set_var("order",$order); $t->set_var("order",$order);
@ -208,8 +210,6 @@
$t->set_var("cat_id",$cat_id); $t->set_var("cat_id",$cat_id);
$t->set_var("qfield",$qfield); $t->set_var("qfield",$qfield);
$t->set_var("query",$query); $t->set_var("query",$query);
$t->set_var("actionurl",$phpgw->link("/addressbook/add.php",
"sort=$sort&order=$order&query=$query&filter=$filter&start=$start&cat_id=$cat_id"));
$t->set_var("start",$start); $t->set_var("start",$start);
$t->set_var("filter",$filter); $t->set_var("filter",$filter);
$t->set_var("cols",$cols); $t->set_var("cols",$cols);

View File

@ -18,6 +18,13 @@
<tr> <tr>
<td width="8%"> <td width="8%">
<form action="{cancel_url}" method="post"> <form action="{cancel_url}" method="post">
<input type="hidden" name="ab_id" value="{ab_id}">
<input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="query" value="{query}">
<input type="hidden" name="start" value="{start}">
<input type="hidden" name="ncat_id" value="{cat_id}">
<input type="submit" name="Cancel" value="{lang_cancel}"> <input type="submit" name="Cancel" value="{lang_cancel}">
</form> </form>
</td> </td>

View File

@ -1,11 +1,11 @@
<!-- BEGIN edit --> <!-- BEGIN edit -->
<input type="hidden" name="ab_id" value="{ab_id}">
<input type="hidden" name="sort" value="{sort}"> <input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}"> <input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}"> <input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="query" value="{query}"> <input type="hidden" name="query" value="{query}">
<input type="hidden" name="start" value="{start}"> <input type="hidden" name="start" value="{start}">
<input type="hidden" name="cat_id" value="{cat_id}">
<TABLE border="0" cellPadding="1" cellSpacing="1" width="95%"> <TABLE border="0" cellPadding="1" cellSpacing="1" width="95%">
<TBODY> <TBODY>
<tr> <tr>
@ -14,14 +14,13 @@
</TD> </TD>
<TD align="left" width="7%"> <TD align="left" width="7%">
{cancel_link} {cancel_link}
<input type="hidden" name="ab_id" value="{ab_id}"> <input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="sort" value="{sort}"> <input type="hidden" name="order" value="{order}">
<input type="hidden" name="order" value="{order}"> <input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="filter" value="{filter}"> <input type="hidden" name="query" value="{query}">
<input type="hidden" name="query" value="{query}"> <input type="hidden" name="start" value="{start}">
<input type="hidden" name="start" value="{start}"> <input type="hidden" name="ncat_id" value="{cat_id}">
<input type="hidden" name="cat_id" value="{cat_id}"> <input type="submit" name="cancel" value="{lang_cancel}"></form>
<input type="submit" name="cancel" value="{lang_cancel}"></form>
</TD> </TD>
<TD align="right"> <TD align="right">
{delete_link} {delete_link}

View File

@ -1,15 +1,26 @@
<!-- BEGIN addressbook_footer --> <!-- BEGIN addressbook_footer -->
</table> </table>
<form method="POST" action="{actionurl}">
<table width="75%" border="0" cellspacing="0" cellpadding="4"> <table width="75%" border="0" cellspacing="0" cellpadding="4">
<tr> <tr>
<td width="16%"> <td width="16%">
<div align="left"> <div align="left">
<form action="{add_url}" method="post">
<input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}">
<input type="hidden" name="cat_id" value="{cat_id}">
<input type="submit" name="Add" value="{lang_add}"> <input type="submit" name="Add" value="{lang_add}">
</div> </div>
</td> </td>
<td width="16%"> <td width="16%">
<div align="left"> <div align="left">
<form action="{vcard_url}" method="post">
<input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}">
<input type="hidden" name="cat_id" value="{cat_id}">
<input type="submit" name="AddVcard" value="{lang_addvcard}"> <input type="submit" name="AddVcard" value="{lang_addvcard}">
</div> </div>
</td> </td>
@ -21,14 +32,24 @@
<td width="16%"> <td width="16%">
<div align="left"> <div align="left">
<form action="{import_url}" method="post"> <form action="{import_url}" method="post">
<input type="submit" name="Import" value="{lang_import}"> <input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}">
<input type="hidden" name="cat_id" value="{cat_id}">
<input type="submit" name="Import" value="{lang_import}">
</form> </form>
</div> </div>
</td> </td>
<td width="16%"> <td width="16%">
<div align="left"> <div align="left">
<form action="{export_url}" method="post"> <form action="{export_url}" method="post">
<input type="submit" name="Export" value="{lang_export}"> <input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}">
<input type="hidden" name="cat_id" value="{cat_id}">
<input type="submit" name="Export" value="{lang_export}">
</form> </form>
</div> </div>
</td> </td>

View File

@ -5,6 +5,12 @@
<br>{searchreturn} <br>{searchreturn}
<form action="{cats_url}" method="POST"> <form action="{cats_url}" method="POST">
{cats}{cats_link} {cats}{cats_link}
<input type="hidden" name="cat_id" value="{cat_id}">
<input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="query" value="{query}">
<input type="hidden" name="start" value="{start}">
<input type="submit" name="cats" value="{lang_cats}"> <input type="submit" name="cats" value="{lang_cats}">
</form> </form>
{search_filter} {search_filter}

View File

@ -11,6 +11,7 @@
<TR> <TR>
<TD align="left"> <TD align="left">
{edit_link} {edit_link}
<input type="hidden" name="ab_id" value="{ab_id}">
{edit_button} {edit_button}
</form> </form>
</TD> </TD>
@ -21,6 +22,7 @@
<input type="hidden" name="filter" value="{filter}"> <input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}"> <input type="hidden" name="start" value="{start}">
<input type="hidden" name="fields" value="{copy_fields}"> <input type="hidden" name="fields" value="{copy_fields}">
<input type="hidden" name="cat_id" value="{cat_id}">
<input type="submit" name="submit" value="{lang_copy}"> <input type="submit" name="submit" value="{lang_copy}">
</form> </form>
</TD> </TD>
@ -31,16 +33,17 @@
<input type="hidden" name="order" value="{order}"> <input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}"> <input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}"> <input type="hidden" name="start" value="{start}">
<input type="hidden" name="cat_id" value="{cat_id}">
<input type="submit" name="VCardform" value="{lang_vcard}"> <input type="submit" name="VCardform" value="{lang_vcard}">
</form> </form>
</TD> </TD>
<TD align="left"> <TD align="left">
{done_link} {done_link}
<input type="hidden" name="ab_id" value="{ab_id}">
<input type="hidden" name="sort" value="{sort}"> <input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}"> <input type="hidden" name="order" value="{order}">
<input type="hidden" name="filter" value="{filter}"> <input type="hidden" name="filter" value="{filter}">
<input type="hidden" name="start" value="{start}"> <input type="hidden" name="start" value="{start}">
<input type="hidden" name="ncat_id" value="{cat_id}">
<input type="submit" name="Doneform" value="{lang_done}"> <input type="submit" name="Doneform" value="{lang_done}">
</form> </form>
</TD> </TD>

View File

@ -115,10 +115,12 @@
$cat = CreateObject('phpgwapi.categories'); $cat = CreateObject('phpgwapi.categories');
$catinfo = $cat->return_single($fields[0]['cat_id']); $catinfo = $cat->return_single($fields[0]['cat_id']);
$catname = $catinfo[0]["name"]; $catname = $catinfo[0]["name"];
if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; }
$cat->app_name = "phpgw"; $cat->app_name = "phpgw";
$catinfo = $cat->return_single($fields[0]['cat_id']); $catinfo = $cat->return_single($fields[0]['cat_id']);
$catname .= $catinfo[0]["name"]; $catname .= $catinfo[0]["name"];
if ($fields[0]['cat_id']) { $cat_id = $fields[0]['cat_id']; }
if (!$catname) { $catname = lang('none'); } if (!$catname) { $catname = lang('none'); }
@ -133,19 +135,15 @@
$sfields = rawurlencode(serialize($fields[0])); $sfields = rawurlencode(serialize($fields[0]));
if ($this->grants[$record_owner] & PHPGW_ACL_EDIT || $record_owner == $phpgw_info['user']['account_id']) 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","ab_id=$ab_id&start=$start&sort=$sort&order=$order&cat_id=$cat_id" $t->set_var('edit_link','<form method="POST" action="' . $phpgw->link("/addressbook/edit.php").'">');
. "&query=$query&sort=$sort").'">');
$t->set_var('edit_button','<input type="submit" name="edit" value="' . lang('Edit') . '">'); $t->set_var('edit_button','<input type="submit" name="edit" value="' . lang('Edit') . '">');
} }
$copylink = '<form method="POST" action="' $copylink = '<form method="POST" action="' . $phpgw->link("/addressbook/add.php").'">';
. $phpgw->link("/addressbook/add.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id").'">'; $vcardlink = '<form method="POST" action="' . $phpgw->link("/addressbook/vcardout.php").'">';
$vcardlink = '<form method="POST" action="' $donelink = '<form method="POST" action="' . $phpgw->link("/addressbook/index.php").'">';
. $phpgw->link("/addressbook/vcardout.php","ab_id=$ab_id&order=$order&start=$start&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id").'">';
$donelink = '<form method="POST" action="'
. $phpgw->link("/addressbook/index.php","order=$order&start=$start&filter=$filter&query=$query&sort=$sort&cat_id=$cat_id").'">';
$t->set_var("access_link",$access_link); $t->set_var("access_link",$access_link);
$t->set_var("ab_id",$ab_id); $t->set_var("ab_id",$ab_id);
@ -153,6 +151,7 @@
$t->set_var("order",$order); $t->set_var("order",$order);
$t->set_var("filter",$filter); $t->set_var("filter",$filter);
$t->set_var("start",$start); $t->set_var("start",$start);
$t->set_var("cat_id",$cat_id);
$t->set_var("view_header",$view_header); $t->set_var("view_header",$view_header);
$t->set_var("cols",$columns_html); $t->set_var("cols",$columns_html);
$t->set_var("lang_ok",lang("ok")); $t->set_var("lang_ok",lang("ok"));