summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0025574)
raw | patch | inline | side by side (parent: 0025574)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 21 Dec 2007 13:59:23 +0000 (13:59 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 21 Dec 2007 13:59:23 +0000 (13:59 +0000) |
-Mail: Placeholder in vcacation message will now be replaced with correct values.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8165 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8165 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/personal/mail/class_mailAccount.inc | patch | blob | history |
diff --git a/gosa-core/plugins/personal/mail/class_mailAccount.inc b/gosa-core/plugins/personal/mail/class_mailAccount.inc
index bb00ffa84d74bf16e66c403c6147b412612b51bb..f123d38257dc3e099be60d61cd3815723a7d983c 100644 (file)
/* Import vacation message? */
if (isset($_POST["import_vacation"]) && isset($this->vacation[$_POST["vacation_template"]])){
- $contents= "";
- $lines= file($_POST["vacation_template"]);
- foreach ($lines as $line){
- if (!preg_match('/^DESC:/', $line)){
- $contents.= $line;
- }
- }
- /* Replace attributes */
- $attrs = array();
- $obj = NULL;
- if(isset($this->parent->by_object['user'])){
- $attrs = $this->parent->by_object['user']->attributes;
- $obj = $this->parent->by_object['user'];
+
+ /* Save message */
+ if($this->multiple_support_active){
+ $contents = file_get_contents($_POST["vacation_template"]);
}else{
- $obj = new user($this->config,$this->dn);
- $attrs = $obj->attributes;
- }
-
- if($obj){
- foreach ($attrs as $val){
- if(preg_match("/dateOfBirth/",$val)){
- if($obj->use_dob){
- $contents= preg_replace("/%$val/",date("Y-d-m",$obj->dateOfBirth),$contents);
- }
- }else {
- $contents= preg_replace("/%$val/",
- $obj->$val, $contents);
- }
-
- /* Replace vacation start and end time */
- if(preg_match("/%start/",$contents)){
- $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
- }
- if(preg_match("/%end/",$contents)){
- $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
- }
- }
+ $contents = $this->prepare_vacation_template(file_get_contents($_POST["vacation_template"]));
}
-
- /* Save message */
$this->gosaVacationMessage= htmlspecialchars($contents);
}
));
}
+
+ /*! \brief Prepare importet vacation string. \
+ Replace placeholder like %givenName a.s.o.
+ @param string Vacation string
+ @return string Completed vacation string
+ */
+ private function prepare_vacation_template($contents)
+ {
+ /* Replace attributes */
+ $attrs = array();
+ $obj = NULL;
+ if(isset($this->parent->by_object['user'])){
+ $attrs = $this->parent->by_object['user']->attributes;
+ $obj = $this->parent->by_object['user'];
+ }else{
+ $obj = new user($this->config,$this->dn);
+ $attrs = $obj->attributes;
+ }
+
+ if($obj){
+ foreach ($attrs as $val){
+ if(preg_match("/dateOfBirth/",$val)){
+ if($obj->use_dob){
+ $contents= preg_replace("/%$val/",date("Y-d-m",$obj->dateOfBirth),$contents);
+ }
+ }else {
+ $contents= preg_replace("/%$val/",
+ $obj->$val, $contents);
+ }
+
+ /* Replace vacation start and end time */
+ if(preg_match("/%start/",$contents)){
+ $contents = preg_replace("/%start/",date("d.m.Y",$this->gosaVacationStart),$contents);
+ }
+ if(preg_match("/%end/",$contents)){
+ $contents = preg_replace("/%end/",date("d.m.Y",$this->gosaVacationStop),$contents);
+ }
+ }
+ }
+ return($contents);
+ }
+
+
+
/* Upated shared folder ACLs
*/
function updateSharedFolder()
}
}
$this->gosaMailDeliveryMode = "[".$tmp."]";
+
+ /* Set vacation message and replace placeholder like %givenName
+ */
+ if(isset($values['gosaVacationMessage'])){
+ $this->gosaVacationMessage = $this->prepare_vacation_template($values['gosaVacationMessage']);
+ }
}
}