sendEmail($user, $interface, $userText, $attach); //load feedback file if (!file_exists(FeedbackXml)) return 'err_file'; $this->feedXmlName = FeedbackXml; $this->feedXml = new DomDocument("1.0","UTF-8"); $this->feedXml->preserveWhiteSpace = false; $this->feedXml->formatOutput = true; if (file_exists($this->feedXmlName)) { $this->feedXml->load($this->feedXmlName); $rootElement = $this->feedXml->documentElement; } else { $rootElement = $this->feedXml->createElement("root"); $this->feedXml->appendChild($rootElement); } if (($this->feedXml == null) or ($rootElement == null)) return 'err_file'; //get feed id - ToDo - to improve $N = $this->feedXml->getElementsByTagName("issue")->length > 0 ? $this->feedXml->getElementsByTagName("issue")->length : 0; $issue = $this->feedXml->createElement("issue", htmlspecialchars($userText)); $issue->setAttribute("user", $user); $issue->setAttribute("userAgent", $userAgent); $issue->setAttribute('interface',$interface); $issue->setAttribute('IP',getenv('REMOTE_ADDR')); $issue->setAttribute("date", date("Y-m-d")); $issue->setAttribute("xml:id", $N); $issue->setAttribute("subject", $subject); if (isset($attach) && ($attach != '')) $issue->setAttribute("attachement",$attach); $rootElement->appendChild($issue); $this->feedXml->save($this->feedXmlName); return 'none'; } protected function sendEmail($user, $interface, $userText, $attach) { $amda = new AmdaClient(); $result = $amda->getUserInfo($user); if ($result['success']) { $from = $result['email']; $to = $this->emails.",".$result['email']; } else { $from = $user; $to = $this->emails; } $subject = 'AMDA FEEDBACK: '.$interface; $message = $userText; if (isset($attach) && ($attach != '')) $message .= "\r\nAttachment : ".$attach; $headers = 'From: '.$from."\r\n". 'Content-type: text/plain; charset=UTF-8'; mail($to, $subject, $message, $headers); } } ?>