1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2025-11-29 11:03:07 +03:00

- merge identical parts of GET and POST code

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@37 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
Christian Boltz
2007-08-20 00:08:50 +00:00
parent 77997f7b33
commit 224cfa340b

View File

@@ -41,24 +41,25 @@ $SESSID_USERNAME = check_session ();
$tmp = preg_split ('/@/', $SESSID_USERNAME); $tmp = preg_split ('/@/', $SESSID_USERNAME);
$USERID_DOMAIN = $tmp[1]; $USERID_DOMAIN = $tmp[1];
if ($_SERVER['REQUEST_METHOD'] == "GET") if (isset ($_GET['username'])) $fUsername = escape_string ($_GET['username']);
{ if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']);
if (isset ($_GET['username'])) $fUsername = escape_string ($_GET['username']);
if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']);
if (check_admin($SESSID_USERNAME)) if (check_admin($SESSID_USERNAME))
{ {
$fCanceltarget= $CONF['postfix_admin_url'] . "/admin/list-virtual.php?domain=$fDomain"; $fCanceltarget= $CONF['postfix_admin_url'] . "/admin/list-virtual.php?domain=$fDomain";
} }
else else
{ {
if (check_owner ($SESSID_USERNAME, $fDomain)) if (check_owner ($SESSID_USERNAME, $fDomain))
{ {
$fCanceltarget= $CONF['postfix_admin_url'] . "/overview.php?domain=$fDomain"; $fCanceltarget= $CONF['postfix_admin_url'] . "/overview.php?domain=$fDomain";
} }
//unauthorized, exit //unauthorized, exit
else { exit; } else { exit; }
} }
if ($_SERVER['REQUEST_METHOD'] == "GET")
{
$result = db_query("SELECT * FROM $table_vacation WHERE email='$fUsername'"); $result = db_query("SELECT * FROM $table_vacation WHERE email='$fUsername'");
if ($result['rows'] == 1) if ($result['rows'] == 1)
@@ -89,20 +90,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']); if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']);
if (isset ($_GET['username'])) $fUsername = escape_string ($_GET['username']); if (isset ($_GET['username'])) $fUsername = escape_string ($_GET['username']);
if (check_admin($SESSID_USERNAME))
{
$fCanceltarget= $CONF['postfix_admin_url'] . "/admin/list-virtual.php?domain=$fDomain";
}
else
{
if (check_owner ($SESSID_USERNAME, $fDomain))
{
$fCanceltarget= $CONF['postfix_admin_url'] . "/overview.php?domain=$fDomain";
}
//unauthorized, exit
else { exit; }
}
$tUseremail = $fUsername; $tUseremail = $fUsername;
if ($tSubject == '') { $tSubject = $PALANG['pUsersVacation_subject_text']; } if ($tSubject == '') { $tSubject = $PALANG['pUsersVacation_subject_text']; }
if ($tBody == '') { $tBody = $PALANG['pUsersVacation_body_text']; } if ($tBody == '') { $tBody = $PALANG['pUsersVacation_body_text']; }
@@ -192,4 +179,5 @@ if (check_admin($SESSID_USERNAME)) {
} }
include ("$incpath/templates/edit-vacation.tpl"); include ("$incpath/templates/edit-vacation.tpl");
include ("$incpath/templates/footer.tpl"); include ("$incpath/templates/footer.tpl");
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?> ?>