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
pull/2/head
Christian Boltz 13 years ago
parent dbf7d1aa74
commit 9bee8d89c1

@ -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';

@ -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';

@ -74,7 +74,7 @@
{else}
{assign var="v_active" value=$PALANG.pOverview_vacation_option}
{/if}
<td><a href="edit-vacation.php?username={$item.username|escape:"url"}&amp;domain={$fDomain|escape:"url"}">{$v_active}</a></td>
<td><a href="vacation.php?username={$item.username|escape:"url"}&amp;domain={$fDomain|escape:"url"}">{$v_active}</a></td>
{/if}
{else}
<td>&nbsp;</td>

@ -7,11 +7,13 @@
<tr>
<th colspan="3">{$PALANG.pUsersVacation_welcome}</th>
</tr>
{if !$authentication_has_role.user}
<tr>
<td class="label"><label>{$PALANG.pUsersLogin_username}:</label></td>
<td><em>{$tUseremail}</em></td>
<td>&nbsp;</td>
</tr>
{/if}
<tr>
<td class="label"><label>{$PALANG.pUsersVacation_activefrom}:</label></td>
<td><input class="flat readonly" name="fActiveFrom" value="{$tActiveFrom}" readonly="readonly" />

@ -13,160 +13,13 @@
* @license GNU GPL v2 or later.
*
* File: vacation.php
* Used by users to set/change their vacation settings.
* Responsible for allowing users to update their vacation status.
*
* Template File: users_vacation.tpl
*
* Template Variables:
*
* tSubject
* tBody
*
* Form POST \ GET Variables:
*
* fSubject
* fBody
* fChange
* fBack
*/
require_once('../common.php');
authentication_require_role('user');
$USERID_USERNAME = authentication_get_username();
$fUsername = authentication_get_username();
// is vacation support enabled in $CONF ?
if($CONF['vacation'] == 'NO') {
header("Location: main.php");
exit(0);
}
date_default_timezone_set(@date_default_timezone_get()); # Suppress date.timezone warnings
$vh = new VacationHandler($fUsername);
//$vh = new VacationHandler(authentication_get_username());
if ($_SERVER['REQUEST_METHOD'] == "GET")
{
$tSubject = '';
$tBody = '';
$tActiveFrom = '';
$tActiveUntil = '';
$details = $vh->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");
require_once('../vacation.php');
$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: */
?>

@ -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($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");
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");
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);
Loading…
Cancel
Save