From 9bee8d89c1bb1bc4fe588957692e19064dbbe238 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 14 Aug 2011 23:12:20 +0000 Subject: [PATCH] Merge users/vacation.php and edit-vacation.php into vacation.php vacation.php - result of merging edit-vacation.php and users/vacation.php - vacation.php comes with the svn history of edit-vacation.php - display "vacation already active" (only) in user mode if vacation is active (would be useful in admin mode too, but needs a text change) - various comment updates - add username in $PALANG[pVacation_result_removed] and $PALANG[pVacation_result_added] using sprintf - change compared to Jan Kruis' patch: - set return url for users to main.php instead of users/main.php - set return url for admins after setting $fDomain. Otherwise the return url does not contain the domain. - removed unused variable $tDomain users/vacation.php: - require(../vacation.php) - remove everything else - whitespace changes in the license header - note: this is completely different from Jan Kruis' patch - his intention was to remove this file and use ../vacation.php. However, with his way all links in the users menu would point to the wrong place/directory edit-vacation.php: - deleted templates/vacation.tpl - display username only in admin mode templates/list-virtual_mailbox.tpl - link changed to merged vacation.php languages/en.lang - add username in $PALANG[pVacation_result_removed] and $PALANG[pVacation_result_added] as sprintf variable - (comments added by Jan Kruis' patch are not part of this commit) languages/nl.lang - translation updates - already contains the sprintf variable in $PALANG[pVacation_result_removed] and $PALANG[pVacation_result_added] (updates for other *.lang files follow in another commit) The following parts of Jan Kruis' patch are not part of this commit: - rejected: - variables.inc.php: don't add $Admin_role and $Return_url If we initialize them, it should be done directly in (edit-)vacation.php, but the current code always sets them already in all cases. - templates/users_main.tpl: do not change url for vacation.php - postponed: - added comments in en.lang about obsolete texts Most parts of this commit (see exceptions above) were provided as patch by Jan Kruis (jan-kruis@SF), see https://sourceforge.net/tracker/?func=detail&aid=3383236&group_id=191583&atid=937966 git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1169 a1433add-5e2c-0410-b055-b7f2511e0802 --- languages/en.lang | 4 +- languages/nl.lang | 46 ++++---- templates/list-virtual_mailbox.tpl | 2 +- templates/vacation.tpl | 2 + users/vacation.php | 177 +++-------------------------- edit-vacation.php => vacation.php | 79 ++++++------- 6 files changed, 77 insertions(+), 233 deletions(-) rename edit-vacation.php => vacation.php (71%) diff --git a/languages/en.lang b/languages/en.lang index da1103d9..a353cb5b 100644 --- a/languages/en.lang +++ b/languages/en.lang @@ -190,8 +190,8 @@ $PALANG['pEdit_vacation_set'] = 'Change / Set away message'; $PALANG['pEdit_vacation_remove'] = 'Remove away message'; $PALANG['pVacation_result_error'] = 'Unable to update auto response settings!'; -$PALANG['pVacation_result_removed'] = 'Auto response has been removed!'; -$PALANG['pVacation_result_added'] = 'Auto response has been enabled!'; +$PALANG['pVacation_result_removed'] = 'Auto response for %s has been removed!'; +$PALANG['pVacation_result_added'] = 'Auto response for %s has been enabled!'; $PALANG['pViewlog_welcome'] = 'View the last 10 actions for '; $PALANG['pViewlog_timestamp'] = 'Timestamp'; diff --git a/languages/nl.lang b/languages/nl.lang index 183eb2d0..fc8fa187 100644 --- a/languages/nl.lang +++ b/languages/nl.lang @@ -12,14 +12,14 @@ $PALANG['edit'] = 'Bewerken'; $PALANG['del'] = 'Verwijder'; $PALANG['exit'] = 'Beëindigen'; $PALANG['cancel'] = 'Annuleren'; -$PALANG['save'] = 'Opslaan'; # XXX Text change: "Save" -> "Save changes" +$PALANG['save'] = 'Wijzigingen opslaan'; $PALANG['confirm'] = 'Weet u het zeker dat u wilt verwijderen?\n'; $PALANG['confirm_domain'] = 'Weet u zeker dat u ALLE data van het domein wilt verwijderen? Dit kan niet ongedaan worden gemaakt!\n'; $PALANG['check_update'] = 'Zoeken naar nieuwe versie'; $PALANG['invalid_parameter'] = 'ongeldige parameter!'; $PALANG['show'] = 'Toon:'; $PALANG['all'] = 'Alle'; -$PALANG['pFooter_logged_as'] = 'aangemeld als %s'; # XXX Text change: 'logged in as %s' (the 'in' was missing) +$PALANG['pFooter_logged_as'] = 'aangemeld als %s'; $PALANG['pLogin_welcome'] = 'Mail beheerders log hier in om uw domeinen te beheren.'; $PALANG['pLogin_username'] = 'Login (e-mail)'; @@ -118,10 +118,10 @@ $PALANG['pCreate_alias_goto_text'] = 'Waar de e-mails heen gestuurd worden.'; $PALANG['pCreate_alias_goto_text_error'] = 'De NAAR is niet geldig.'; $PALANG['pCreate_alias_result_error'] = 'Mislukt om de alias toe te voegen.'; $PALANG['pCreate_alias_result_success'] = 'De alias is toegevoegd.'; -$PALANG['pCreate_alias_catchall_text'] = 'Om een catch-all te gebruiken, dient u een "*" (asteric) in te vullen als alias. Voor domein naar domein forwarding gebruik "*@domein.tld" als naar.'; # XXX check/beautify - was split in two lines before +$PALANG['pCreate_alias_catchall_text'] = 'Om een catch-all te gebruiken, dient u een "*" (asteric) in te vullen als alias. Voor domein naar domein forwarding gebruik "*@domein.tld" als naar.'; -$PALANG['pEdit_alias_welcome'] = 'Bewerk een alias voor uw domein.'; # XXX Text change to: 'Edit forwarding settings' -$PALANG['pEdit_alias_help'] = 'Een alias per regel.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' +$PALANG['pEdit_alias_welcome'] = 'Bewerk een alias voor uw domein.'; +$PALANG['pEdit_alias_help'] = 'Meerdere e-mailadressen toegestaan. Slechts één alias per regel.'; $PALANG['pEdit_alias_address'] = 'Alias'; $PALANG['pEdit_alias_address_error'] = 'Mislukt om alias te vinden!'; # obsolete $PALANG['pEdit_alias_goto'] = 'Naar'; @@ -143,7 +143,7 @@ $PALANG['pCreate_mailbox_username_text_error3'] = 'U bezit het maximum aantal ma $PALANG['pCreate_mailbox_password'] = 'Wachtwoord'; $PALANG['pCreate_mailbox_password2'] = 'Wachtwoord nogmaals'; $PALANG['pCreate_mailbox_password_text'] = 'Wachtwoord voor POP3/IMAP'; -$PALANG['pCreate_mailbox_password_text_error'] = 'De wachtwoorden die u opgaf komen niet overeen. Of zijn leeg.'; # XXX check/beautify - was split in two lines before +$PALANG['pCreate_mailbox_password_text_error'] = 'De wachtwoorden die u opgaf komen niet overeen of zijn leeg.'; $PALANG['pCreate_mailbox_name'] = 'Naam'; # obsolete $PALANG['pCreate_mailbox_name_text'] = 'Volledige naam'; $PALANG['pCreate_mailbox_quota'] = 'Quota'; # obsolete @@ -178,7 +178,7 @@ $PALANG['pPassword_password_current'] = 'Huidig wachtwoord'; $PALANG['pPassword_password_current_text_error'] = 'U heeft uw huidige wachtwoord niet opgegeven.'; $PALANG['pPassword_password'] = 'Nieuw wachtwoord'; $PALANG['pPassword_password2'] = 'Nieuw wachtwoord (nogmaals)'; -$PALANG['pPassword_password_text_error'] = 'De wachtwoorden komen niet overeen. Of zijn leeg.'; # XXX check/beautify - was split in two lines before +$PALANG['pPassword_password_text_error'] = 'De wachtwoorden komen niet overeen of zijn leeg.'; $PALANG['pPassword_button'] = 'Wijzig wachtwoord'; $PALANG['pPassword_result_error'] = 'Mislukt om uw wachtwoord te veranderen.'; $PALANG['pPassword_result_success'] = 'Uw wachtwoord is veranderd.'; @@ -186,8 +186,8 @@ $PALANG['pPassword_result_success'] = 'Uw wachtwoord is veranderd.'; $PALANG['pEdit_vacation_set'] = 'Verander / Activeer beantwoorden tekst'; $PALANG['pEdit_vacation_remove'] = 'Verwijder beantwoorden tekst'; $PALANG['pVacation_result_error'] = 'Niet in staat automatisch beantwoorden te wijzigen!'; -$PALANG['pVacation_result_removed'] = 'Automatisch beantwoorden is gedeactiveerd!'; -$PALANG['pVacation_result_added'] = 'Automatisch beantwoorden is geactiveerd!'; +$PALANG['pVacation_result_removed'] = 'Automatisch beantwoorden is voor %s gedeactiveerd!'; +$PALANG['pVacation_result_added'] = 'Automatisch beantwoorden is voor %s geactiveerd!'; $PALANG['pViewlog_welcome'] = 'Laat de laatste 10 actie\'s zien van '; $PALANG['pViewlog_timestamp'] = 'Tijd'; @@ -195,12 +195,12 @@ $PALANG['pViewlog_username'] = 'Beheerder'; $PALANG['pViewlog_domain'] = 'Domein'; $PALANG['pViewlog_action'] = 'Actie'; $PALANG['pViewlog_data'] = 'Aanpassing'; -$PALANG['pViewlog_action_create_domain'] = 'create domain'; # XXX -$PALANG['pViewlog_action_delete_domain'] = 'delete domain'; # XXX -$PALANG['pViewlog_action_edit_domain'] = 'edit domain'; # XXX -$PALANG['pViewlog_action_create_mailbox'] = 'Mailbox toegevoegd'; -$PALANG['pViewlog_action_delete_mailbox'] = 'Mailbox verwijderd'; -$PALANG['pViewlog_action_edit_mailbox'] = 'Mailbox bewerkt'; +$PALANG['pViewlog_action_create_domain'] = 'domein toegevoegd'; +$PALANG['pViewlog_action_delete_domain'] = 'domein verwijderd'; +$PALANG['pViewlog_action_edit_domain'] = 'domein bewerkt'; +$PALANG['pViewlog_action_create_mailbox'] = 'mailbox toegevoegd'; +$PALANG['pViewlog_action_delete_mailbox'] = 'mailbox verwijderd'; +$PALANG['pViewlog_action_edit_mailbox'] = 'mailbox bewerkt'; $PALANG['pViewlog_action_edit_mailbox_state'] = 'status actieve mailbox bewerkt'; $PALANG['pViewlog_action_create_alias'] = 'alias toegevoegd'; $PALANG['pViewlog_action_create_alias_domain'] = 'maak domein alias'; @@ -247,7 +247,7 @@ $PALANG['pAdminList_domain_description'] = 'Omschrijving'; $PALANG['pAdminList_domain_aliases'] = 'Aliassen'; $PALANG['pAdminList_domain_mailboxes'] = 'Mailboxen'; $PALANG['pAdminList_domain_maxquota'] = 'Quota (MB)'; # XXX no longer used -$PALANG['pAdminList_domain_quota'] = 'Domain quota (MB)'; # XXX +$PALANG['pAdminList_domain_quota'] = 'Domein quota (MB)'; # XXX $PALANG['pAdminList_domain_transport'] = 'Transport'; $PALANG['pAdminList_domain_backupmx'] = 'Back-up MX'; $PALANG['pAdminList_domain_modified'] = 'Laatst bewerkt'; @@ -285,7 +285,7 @@ $PALANG['pAdminCreate_domain_backupmx'] = 'Mail server is back-up MX'; # obsolet $PALANG['pAdminCreate_domain_button'] = 'Voeg Domein toe'; $PALANG['pAdminCreate_domain_result_error'] = 'Mislukt om het domein toe te voegen.'; $PALANG['pAdminCreate_domain_result_success'] = 'Domein is toegevoegd!'; -$PALANG['pAdminDelete_admin_error'] = 'Unable to delete admin!'; # XXX +$PALANG['pAdminDelete_admin_error'] = 'Niet in staat beheerder te verwijderen!'; $PALANG['pAdminDelete_domain_error'] = 'Niet in staat domein te verwijderen!'; $PALANG['pAdminDelete_alias_domain_error'] = 'Niet in staat domein alias te verwijderen!'; @@ -298,9 +298,9 @@ $PALANG['pAdminEdit_domain_mailboxes'] = 'Mailboxen'; $PALANG['pAdminEdit_domain_mailboxes_text'] = '-1 = uit | 0 = onbeperkt'; $PALANG['pAdminEdit_domain_maxquota'] = 'Max Quota'; $PALANG['pAdminEdit_domain_maxquota_text'] = 'MB | -1 = uit | 0 = onbeperkt'; -$PALANG['pAdminEdit_domain_quota'] = 'Domain Quota'; # XXX +$PALANG['pAdminEdit_domain_quota'] = 'Domein Quota'; # XXX $PALANG['pAdminEdit_domain_transport'] = 'Transport'; -$PALANG['pAdminEdit_domain_transport_text'] = 'Defineer transport'; # XXX check - Defin_i_eer or Defineer? +$PALANG['pAdminEdit_domain_transport_text'] = 'Definieer transport'; $PALANG['pAdminEdit_domain_backupmx'] = 'Mail server is back-up MX'; $PALANG['pAdminEdit_domain_active'] = 'Actief'; $PALANG['pAdminEdit_domain_button'] = 'Bewerk domein'; # XXX text no longer used @@ -313,7 +313,7 @@ $PALANG['pAdminCreate_admin_username_text_error1'] = 'Beheerder is geen geldig e $PALANG['pAdminCreate_admin_username_text_error2'] = 'De beheerder bestaat al of is niet geldig'; $PALANG['pAdminCreate_admin_password'] = 'Wachtwoord'; # obsolete $PALANG['pAdminCreate_admin_password2'] = 'Wachtwoord (nogmaals)'; # obsolete -$PALANG['pAdminCreate_admin_password_text_error'] = 'De wachtwoorden die u opgaf komen niet overeen. Of zijn leeg.'; # XXX check/beautify - was split in two lines before +$PALANG['pAdminCreate_admin_password_text_error'] = 'De wachtwoorden die u opgaf komen niet overeen of zijn leeg.'; $PALANG['pAdminCreate_admin_button'] = 'Voeg beheerder toe'; $PALANG['pAdminCreate_admin_result_error'] = 'Mislukt om beheerder toe te voegen!'; $PALANG['pAdminCreate_admin_result_success'] = 'Beheerder is toegevoegd.'; @@ -323,7 +323,7 @@ $PALANG['pAdminEdit_admin_welcome'] = 'Bewerk een domein beheerder'; $PALANG['pAdminEdit_admin_username'] = 'Beheerder'; $PALANG['pAdminEdit_admin_password'] = 'Wachtwoord'; $PALANG['pAdminEdit_admin_password2'] = 'Wachtwoord (nogmaals)'; -$PALANG['pAdminEdit_admin_password_text_error'] = 'De wachtwoorden die u opgaf komen niet overeen. Of zijn leeg.'; # XXX check/beautify - was split in two lines before +$PALANG['pAdminEdit_admin_password_text_error'] = 'De wachtwoorden die u opgaf komen niet overeen of zijn leeg.'; $PALANG['pAdminEdit_admin_active'] = 'Actief'; $PALANG['pAdminEdit_admin_super_admin'] = 'Super administrator'; $PALANG['pAdminEdit_admin_button'] = 'Bewerk beheerder'; # XXX text no longer used @@ -360,8 +360,8 @@ $PALANG['pUsersVacation_button_away'] = 'Afwezig'; $PALANG['pUsersVacation_button_back'] = 'Kom terug'; $PALANG['pUsersVacation_result_error'] = 'Mislukt om uw automatisch beantwoorden instellingen te wijzigen.'; $PALANG['pUsersVacation_result_success'] = 'Uw automatisch beantwoorden is verwijderd.'; -$PALANG['pUsersVacation_activefrom'] = 'Active from'; # XXX -$PALANG['pUsersVacation_activeuntil'] = 'Active until'; # XXX +$PALANG['pUsersVacation_activefrom'] = 'Actief vanaf'; +$PALANG['pUsersVacation_activeuntil'] = 'Actief t/m'; $PALANG['pCreate_dbLog_createmailbox'] = 'mailbox aangemaakt'; $PALANG['pCreate_dbLog_createalias'] = 'alias aangemaakt'; diff --git a/templates/list-virtual_mailbox.tpl b/templates/list-virtual_mailbox.tpl index 71d952ba..a47ba079 100644 --- a/templates/list-virtual_mailbox.tpl +++ b/templates/list-virtual_mailbox.tpl @@ -74,7 +74,7 @@ {else} {assign var="v_active" value=$PALANG.pOverview_vacation_option} {/if} - {$v_active} + {$v_active} {/if} {else}   diff --git a/templates/vacation.tpl b/templates/vacation.tpl index 616378ec..3766ddfa 100644 --- a/templates/vacation.tpl +++ b/templates/vacation.tpl @@ -7,11 +7,13 @@ {$PALANG.pUsersVacation_welcome} + {if !$authentication_has_role.user} {$tUseremail}   + {/if} diff --git a/users/vacation.php b/users/vacation.php index f85c9646..5498875b 100644 --- a/users/vacation.php +++ b/users/vacation.php @@ -1,172 +1,25 @@ get_details(); - if($details != false) { - $tSubject = $details['subject']; - $tBody = $details['body']; - $fActiveFrom = $details['activeFrom']; - $fActiveUntil = $details['activeUntil']; - } - - if($vh->check_vacation()) { - flash_info($PALANG['pUsersVacation_welcome_text']); - } - - $tUseremail = $fUsername; - - //set a default, reset fields for coming back selection - if ($tSubject == '') { $tSubject = html_entity_decode($PALANG['pUsersVacation_subject_text'], ENT_QUOTES, 'UTF-8'); } - if ($tBody == '') { $tBody = html_entity_decode($PALANG['pUsersVacation_body_text'], ENT_QUOTES, 'UTF-8'); } -} - -if ($_SERVER['REQUEST_METHOD'] == "POST") -{ - if(isset($_POST['fCancel'])) { - header("Location: main.php"); - exit(0); - } - - - $tActiveFrom = date ("Y-m-d 00:00:00", strtotime (safepost('fActiveFrom'))); - $tActiveUntil = date ("Y-m-d 23:59:59", strtotime (safepost('fActiveUntil'))); - - $tSubject = safepost('fSubject'); - $fSubject = $tSubject; - $tBody = safepost('fBody'); - $fBody = $tBody; - - $fChange = escape_string (safepost('fChange')); - $fBack = escape_string (safepost('fBack')); - - $tUseremail = $fUsername; - - //set a default, reset fields for coming back selection - if ($tSubject == '') { $tSubject = html_entity_decode($PALANG['pUsersVacation_subject_text'], ENT_QUOTES, 'UTF-8'); } - if ($tBody == '') { $tBody = html_entity_decode($PALANG['pUsersVacation_body_text'], ENT_QUOTES, 'UTF-8'); } - - // if they've set themselves change OR back, delete any record of vacation emails. - // the user is going away - set the goto alias and vacation table as necessary. - -// if (!empty ($fChange)) -// { -// if(!$vh->set_away($fSubject, $fBody, $tActiveFrom, $tActiveUntil)) { -// $error = 1; -// flash_error($PALANG['pUsersVacation_result_error']); -// } -// flash_info($PALANG['pVacation_result_added']); -// header ("Location: main.php"); -// exit; -// } -// -// if (!empty ($fBack)) { -// $vh->remove(); -// flash_info($PALANG['pUsersVacation_result_success']); -// header ("Location: main.php"); -// exit; -// } - - //Set the vacation data for $fUsername - if (!empty ($fChange)) - { - if(!$vh->set_away($fSubject, $fBody, $tActiveFrom, $tActiveUntil)) { - $error = 1; - } - } - - //if change, remove old one, then perhaps set new one - if (!empty ($fBack)) - { - if(!$vh->remove()) { - $error = 1; - } - } - -} -// If NO error then diplay flash message and go back to right url where we came from -if($error == 0) { - if(!empty ($fBack)) { - $Flash_Message = $PALANG['pVacation_result_removed'] ; //TODO adding useremail to flash info depending on $ - flash_info($Flash_Message); - header ("Location: main.php"); - exit; - } - if(!empty($fChange)) { - $Flash_Message =( $PALANG['pVacation_result_added']); //TODO adding useremail to flash info depending on $$ - flash_info($Flash_Message); - header ("Location: main.php"); - exit; - } -} -else { - $Flash_Message = $PALANG['pVacation_result_error'] ; //TODO adding useremail to flash info depending on $Role - flash_error($Flash_Message); -} - -if (empty ($fActiveFrom)) - $fActiveFrom = date ("Y-m-d"); -if (empty ($fActiveUntil)) - $fActiveUntil = date ("Y-m-d"); - -$smarty->assign ('tUseremail', $tUseremail); -$smarty->assign ('tSubject', $tSubject); -$smarty->assign ('tBody', $tBody); -$smarty->assign ('tActiveFrom', date ("d.m.Y", strtotime ($fActiveFrom))); -$smarty->assign ('tActiveUntil', date ("d.m.Y", strtotime ($fActiveUntil))); -$smarty->assign ('smarty_template', 'vacation'); -$smarty->display ('index.tpl'); /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ ?> diff --git a/edit-vacation.php b/vacation.php similarity index 71% rename from edit-vacation.php rename to vacation.php index abf4216e..f49a4a4c 100644 --- a/edit-vacation.php +++ b/vacation.php @@ -20,15 +20,16 @@ * Template Variables: * * tUseremail + * tActiveFrom + * tActiveUntil * tSubject * tBody * * Form POST \ GET Variables: * - * fRole * fUsername * fDomain - * fCanceltarget + * fCancel * fChange * fBack * fQuota @@ -37,43 +38,44 @@ require_once('common.php'); -if($CONF['vacation'] == 'NO') { - header("Location: list-virtual.php"); - exit(0); -} - -// TODO -// Get the $Role of who wants to modify vacation setiing [admin of user] -// on $Role get correct Username and domain of emailname -// for wtich we are going to modify thet vacation setting. -// This has to by don up front before display new windows. - - $SESSID_USERNAME = authentication_get_username(); $tmp = preg_split ('/@/', $SESSID_USERNAME); $USERID_DOMAIN = $tmp[1]; // only allow admins to change someone else's 'stuff' if(authentication_has_role('admin')) { + $Admin_role = 1 ; + if (isset($_GET['username'])) $fUsername = escape_string ($_GET['username']); if (isset($_GET['domain'])) $fDomain = escape_string ($_GET['domain']); + $Return_url = "list-virtual.php?domain=$fDomain"; } else { + $Admin_role = 0 ; +# $Return_url = "users/main.php"; + $Return_url = "main.php"; + authentication_require_role('user'); $fUsername = $SESSID_USERNAME; $fDomain = $USERID_DOMAIN; } +// is vacation support enabled in $CONF ? +if($CONF['vacation'] == 'NO') { + header ("Location: $Return_url"); + exit(0); +} + date_default_timezone_set(@date_default_timezone_get()); # Suppress date.timezone warnings $vh = new VacationHandler($fUsername); -if ($_SERVER['REQUEST_METHOD'] == "GET") -{ +if ($_SERVER['REQUEST_METHOD'] == "GET") { $tSubject = ''; $tBody = ''; $tActiveFrom = ''; $tActiveUntil = ''; + $tUseremail = $fUsername; $details = $vh->get_details(); if($details != false) { @@ -83,8 +85,9 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") $tActiveUntil = $details['activeUntil']; } - $tUseremail = $fUsername; - $tDomain = $fDomain; + if($vh->check_vacation() and (!$Admin_role)) { + flash_info($PALANG['pUsersVacation_welcome_text']); + } //set a default, reset fields for coming back selection if ($tSubject == '') { $tSubject = html_entity_decode($PALANG['pUsersVacation_subject_text'], ENT_QUOTES, 'UTF-8'); } @@ -94,7 +97,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET") if ($_SERVER['REQUEST_METHOD'] == "POST") { if(isset($_POST['fCancel'])) { - header("Location: list-virtual.php?domain=$fDomain"); + header ("Location: $Return_url"); exit(0); } @@ -109,25 +112,15 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") $fChange = escape_string (safepost('fChange')); $fBack = escape_string (safepost('fBack')); - if(authentication_has_role('admin') && isset($_GET['domain'])) { - $fDomain = escape_string ($_GET['domain']); - } - else { - $fDomain = $USERID_DOMAIN; - } - if(authentication_has_role('admin') && isset ($_GET['username'])) { - $fUsername = escape_string($_GET['username']); - } - else { - $fUsername = authentication_get_username(); - } - $tUseremail = $fUsername; //set a default, reset fields for coming back selection if ($tSubject == '') { $tSubject = html_entity_decode($PALANG['pUsersVacation_subject_text'], ENT_QUOTES, 'UTF-8'); } if ($tBody == '') { $tBody = html_entity_decode($PALANG['pUsersVacation_body_text'], ENT_QUOTES, 'UTF-8'); } + // if they've set themselves change OR back, delete any record of vacation emails. + // the user is going away - set the goto alias and vacation table as necessary. + //Set the vacation data for $fUsername if (!empty ($fChange)) { @@ -143,33 +136,29 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") $error = 1; } } - } -// If NO error then diplay flash message and go back to right url where we came from + +// If NO error then diplay flash message and go back to right url where we came from if($error == 0) { if(!empty ($fBack)) { - $Flash_Message = $PALANG['pVacation_result_removed'] ; //TODO adding useremail to flash info depending on $Role - flash_info($Flash_Message); - header ("Location: list-virtual.php?domain=$fDomain"); - exit; + flash_info(sprintf($PALANG['pVacation_result_removed'],$tUseremail)); + header ("Location: $Return_url"); + exit; } if(!empty($fChange)) { - $Flash_Message =( $PALANG['pVacation_result_added']); //TODO adding useremail to flash info depending on $Role - flash_info($Flash_Message); - header ("Location: list-virtual.php?domain=$fDomain"); - exit; + flash_info(sprintf($PALANG['pVacation_result_added'],$tUseremail)); + header ("Location: $Return_url"); + exit; } } else { - $Flash_Message = $PALANG['pVacation_result_error'] ; //TODO adding useremail to flash info depending on $Role - flash_error($Flash_Message); + flash_error($PALANG['pVacation_result_error']); } if (empty ($tActiveFrom)) $tActiveFrom = date ("Y-m-d"); if (empty ($tActiveUntil)) $tActiveUntil = date ("Y-m-d"); - $smarty->assign ('tUseremail', $tUseremail); $smarty->assign ('tSubject', $tSubject); $smarty->assign ('tBody', $tBody);