You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
postfixadmin/vacation.php

196 lines
6.4 KiB
PHTML

<?php
/**
* Postfix Admin
*
* LICENSE
* This source file is subject to the GPL license that is bundled with
* this package in the file LICENSE.TXT.
*
* Further details on the project are available at http://postfixadmin.sf.net
*
* @version $Id$
* @license GNU GPL v2 or later.
*
* File: edit-vacation.php
* Responsible for allowing users to update their vacation status.
*
* Template File: edit-vacation.tpl
*
* Template Variables:
*
* tUseremail
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
13 years ago
* tActiveFrom
* tActiveUntil
* tSubject
* tBody
*
* Form POST \ GET Variables:
*
* fUsername
* fDomain
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
13 years ago
* fCancel
* fChange
* fBack
* fQuota
* fActive
*/
require_once('common.php');
// only allow admins to change someone else's 'stuff'
if(authentication_has_role('admin')) {
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
13 years ago
$Admin_role = 1 ;
$fUsername = safeget('username');
list(/*NULL*/,$fDomain) = explode('@',$fUsername);
$Return_url = "list-virtual.php?domain=" . urlencode($fDomain);
# TODO: better check for valid username (check if mailbox exists)
# TODO: (should be done in VacationHandler)
if ($fDomain == '' || !check_owner(authentication_get_username(), $fDomain)) {
die("Invalid username!"); # TODO: better error message
}
}
else {
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
13 years ago
$Admin_role = 0 ;
# $Return_url = "users/main.php";
$Return_url = "main.php";
authentication_require_role('user');
$fUsername = authentication_get_username();
}
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
13 years ago
// 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);
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
13 years ago
if ($_SERVER['REQUEST_METHOD'] == "GET") {
$tSubject = '';
$tBody = '';
$tActiveFrom = '';
$tActiveUntil = '';
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
13 years ago
$tUseremail = $fUsername;
$tReply_Type = '';
$tInterval_Time = '';
$details = $vh->get_details();
if($details != false) {
$tSubject = $details['subject'];
$tBody = $details['body'];
$tReply_Type = $details['reply_type'];
$tInterval_Time = $details['interval_time'];
$tActiveFrom = $details['activeFrom'];
$tActiveUntil = $details['activeUntil'];
}
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
13 years ago
if($vh->check_vacation() and (!$Admin_role)) {
# TODO: would also be useful for admins, but needs a text change to include the username
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
13 years ago
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'); }
if ($tBody == '') { $tBody = html_entity_decode($PALANG['pUsersVacation_body_text'], ENT_QUOTES, 'UTF-8'); }
if ($tReply_Type =='') { $tReply_Type = $CONF['vacation_replytype_default'];}
if ($tReply_Type =='One Reply') { $tInterval_Time = '0';}
if ($tReply_Type =='Auto Reply') { $tInterval_Time = $CONF['vacation_autoreplydelay_default'];}
if (($tReply_Type =='Interval Reply') and ($tInterval_Time =='')) { $tInterval_Time = $CONF['vacation_intervaldelay_default'];}
if (($tReply_Type =='Interval Reply') and ($tInterval_Time <= $CONF['vacation_autoreplydelay_default'])) { $tInterval_Time = $CONF['vacation_intervaldelay_default'];}
}
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
if(isset($_POST['fCancel'])) {
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
13 years ago
header ("Location: $Return_url");
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;
$tReply_Type = safepost('fReply_Type');
$tInterval_Time = safepost('fInterval_Time');
$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 ($tReply_Type =='') { $tReply_Type = $CONF['vacation_replytype_default'];}
if ($tReply_Type =='One Reply') { $tInterval_Time = '0';}
if ($tReply_Type =='Auto Reply') { $tInterval_Time = $CONF['vacation_autoreplydelay_default'];}
if (($tReply_Type =='Interval Reply') and ($tInterval_Time =='')) { $tInterval_Time = $CONF['vacation_intervaldelay_default'];}
if (($tReply_Type =='Interval Reply') and ($tInterval_Time <= $CONF['vacation_autoreplydelay_default'])) { $tInterval_Time = $CONF['vacation_intervaldelay_default'];}
$fReply_Type = $tReply_Type ;
$fInterval_Time = $tInterval_Time;
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
13 years ago
// 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))
{
if(!$vh->set_away($fSubject, $fBody, $fReply_Type, $fInterval_Time, $tActiveFrom, $tActiveUntil)) {
$error = 1;
}
}
//if change, remove old one, then perhaps set new one
if (!empty ($fBack))
{
if(!$vh->remove()) {
$error = 1;
}
}
}
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
13 years ago
// If NO error then diplay flash message and go back to right url where we came from
if($error == 0) {
if(!empty ($fBack)) {
flash_info(sprintf($PALANG['pVacation_result_removed'],htmlentities($tUseremail)));
header ("Location: $Return_url");
exit;
}
if(!empty($fChange)) {
flash_info(sprintf($PALANG['pVacation_result_added'],htmlentities($tUseremail)));
header ("Location: $Return_url");
exit;
}
}
else {
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
13 years ago
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);
$smarty->assign ('tActiveFrom', date ("d.m.Y", strtotime ($tActiveFrom)));
$smarty->assign ('tActiveUntil', date ("d.m.Y", strtotime ($tActiveUntil)));
$smarty->assign ('select_options', select_options ( $CONF ['vacation_choice_of_reply'], array ($tReply_Type)),false);
$smarty->assign ('tInterval_Time', $tInterval_Time);
$smarty->assign ('smarty_template', 'vacation');
$smarty->display ('index.tpl');
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?>