summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 26b0f45)
raw | patch | inline | side by side (parent: 26b0f45)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 2 Oct 2009 09:43:49 +0000 (09:43 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 2 Oct 2009 09:43:49 +0000 (09:43 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14473 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/mail/personal/mail/class_mailAccount.inc | patch | blob | history |
diff --git a/gosa-plugins/mail/personal/mail/class_mailAccount.inc b/gosa-plugins/mail/personal/mail/class_mailAccount.inc
index 02eb27896ab02b1fd911786292cde060beb6ba71..d193a91a3f44c793fbc40702ecb3adfa4d6a6927 100644 (file)
/* GOsa mail attributes */
var $mail = "";
- var $gosaVacationStart = 0;
- var $gosaVacationStop = 0;
+ var $gosaVacationStart = "";
+ var $gosaVacationStop = "";
var $gosaMailAlternateAddress = array();
var $gosaMailForwardingAddress = array();
var $gosaMailDeliveryMode = "[L ]";
/* Disconnect mailMethod. Connect on demand later.
*/
$this->mailMethod->disconnect();
+
+ /* Convert start/stop dates */
+ #TODO: use date format
+ $this->gosaVacationStart= date('d.m.Y', $this->gosaVacationStart);
+ $this->gosaVacationStop= date('d.m.Y', $this->gosaVacationStop);
}
*/
if($this->mailMethod->vacationRangeEnabled()){
$smarty->assign("rangeEnabled", TRUE);
- if($this->gosaVacationStop ==0){
- $date= getdate(time());
- $date["mday"]++;
- }else{
- $date= getdate($this->gosaVacationStop);
- }
- $smarty->assign("end_day", $date["mday"]);
- $smarty->assign("end_month", $date["mon"]-1);
- $smarty->assign("end_year", $date["year"]);
-
- if($this->gosaVacationStart == 0){
- $date= getdate(time());
- }else{
- $date= getdate($this->gosaVacationStart);
- }
- $smarty->assign("start_day", $date["mday"]);
- $smarty->assign("start_month", $date["mon"]-1);
- $smarty->assign("start_year", $date["year"]);
- $days= array();
- for($d= 1; $d<32; $d++){
- $days[$d]= $d;
- }
- $years= array();
- for($y= $date['year']-10; $y<$date['year']+10; $y++){
- $years[]= $y;
- }
- $months= msgPool::months();
- $smarty->assign("months", $months);
- $smarty->assign("years", $years);
- $smarty->assign("days", $days);
}
/* fill filter settings
/* Replace vacation start and end time */
if($this->mailMethod->vacationRangeEnabled()){
if(preg_match("/%start/",$contents)){
- $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
+ $contents = preg_replace("/%start/",$this->gosaVacationStart,$contents);
}
if(preg_match("/%end/",$contents)){
- $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
+ $contents = preg_replace("/%end/",$this->gosaVacationStop,$contents);
}
}else{
if(preg_match("/%start/",$contents)){
}elseif (!preg_match('/V/', $this->gosaMailDeliveryMode)){
unset($this->attrs['gosaVacationStart']);
unset($this->attrs['gosaVacationStop']);
+ } else {
+ /* Adapt values to be timestamps */
+ list($day, $month, $year)= split('\.', $this->gosaVacationStart);
+ $this->attrs['gosaVacationStart']= mktime(0,0,0,$month, $day, $year);
+ list($day, $month, $year)= split('\.', $this->gosaVacationStop);
+ $this->attrs['gosaVacationStop']= mktime(0,0,0,$month, $day, $year);
}
/* Map method attributes */
$message[]= msgPool::required(_("Spam folder"));
}
- if ($this->mailMethod->vacationRangeEnabled()
- && preg_match('/V/', $this->gosaMailDeliveryMode)
- && $this->gosaVacationStart > $this->gosaVacationStop){
- $message[]= msgPool::invalid(_("Vacation interval"));
+ if ($this->mailMethod->vacationRangeEnabled() && preg_match('/V/', $this->gosaMailDeliveryMode)){
+
+ /* Check date strings */
+ $state= true;
+ if ($this->gosaVacationStart == "" || !tests::is_date($this->gosaVacationStart)) {
+ $message[]= msgPool::invalid(_("from"),$this->gosaVacationStart);
+ $state= false;
+ }
+ if ($this->gosaVacationStart == "" || !tests::is_date($this->gosaVacationStop)) {
+ $message[]= msgPool::invalid(_("to"),$this->gosaVacationStop);
+ $state= false;
+ }
+
+ #TODO: take care of date format
+ if ($state) {
+ list($day, $month, $year)= split('\.', $this->gosaVacationStart);
+ $start= mktime(0,0,0,$month, $day, $year);
+ list($day, $month, $year)= split('\.', $this->gosaVacationStop);
+ $stop= mktime(0,0,0,$month, $day, $year);
+ if($start > $stop){
+ $message[]= msgPool::invalid(_("Vacation interval"));
+ }
+ }
}
return($message);
}
$message[]= msgPool::required(_("Spam folder"));
}
- if ($this->mailMethod->vacationRangeEnabled() && in_array("use_vacation",$this->multi_boxes) &&
- preg_match('/V/', $this->gosaMailDeliveryMode) && $this->gosaVacationStart > $this->gosaVacationStop){
- $message[]= msgPool::invalid(_("Vacation interval"));
+ if ($this->mailMethod->vacationRangeEnabled() && preg_match('/V/', $this->gosaMailDeliveryMode)){
+
+ /* Check date strings */
+ $state= true;
+ if ($this->gosaVacationStart == "" || !tests::is_date($this->gosaVacationStart)) {
+ $message[]= msgPool::invalid(_("from"),$this->gosaVacationStart);
+ $state= false;
+ }
+ if ($this->gosaVacationStart == "" || !tests::is_date($this->gosaVacationStop)) {
+ $message[]= msgPool::invalid(_("to"),$this->gosaVacationStop);
+ $state= false;
+ }
+
+ #TODO: take care of date format
+ if ($state) {
+ list($day, $month, $year)= split('\.', $this->gosaVacationStart);
+ $start= mktime(0,0,0,$month, $day, $year);
+ list($day, $month, $year)= split('\.', $this->gosaVacationStop);
+ $stop= mktime(0,0,0,$month, $day, $year);
+ if($start > $stop){
+ $message[]= msgPool::invalid(_("Vacation interval"));
+ }
+ }
}
return($message);
}