<?php header("Content-type: text/xml"); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //require("../classes/email.php"); global $ADEI; global $ADEI_ROOTDIR; $ADEI->RequireClass("email"); $EMAIL = new EMAIL(); function genEmailContent($props) { $host = $_SERVER['HTTP_HOST']; $location = $props['url']; $query; $i = 1; foreach ($props as $key => $value) { if ($key != 'from' && $key != 'to' && $key != 'message' && $key != 'attachement' && $key != 'adei_session' && $key != 'task' && $key != 'service' && $key != 'url') { $query .= "&" . $key . "=" . $value; } } $filearray = explode('/', $props['attachement']); $file = $filearray[count($file) - 1]; $url = "{$location}" . "#" . "{$query}"; $message = "<html><head><title>Adei Graph</title></head><body><p>"; $message .= "<p>" . $props['message'] . "</p>"; $message .= "<p><a href='" . $url . "'>Link to Graph</a></p>"; $message .= "<p><img src='{$file}' /></p>"; $message .= "</body></html>"; return $message; }
<?php // imap postkasti sisu hankimine if (isset($v->post->ptable["data"]["imap"])) { require PLUGIN_PATH . "/srm/inc/lib/class_email.php"; $d = new DATABASE(); if (!$d->connect(DB_HOST, DB_USER, DB_PASS, PLUGIN_SRM)) { $w->alert[ERROR][] = "C001 " . $l->txt_err_open_database; return false; } $email = new EMAIL($d, $v->post->ptable["data"]["imap"]); $email->fetch(); $detect = ["Tellimus / Order: #", "Tellimus: #", "Order: #", "Ylesanne: #"]; $data_array = []; foreach ($email->c as $msg) { $found_reply = false; foreach ($detect as $detected) { if (strpos($msg->subject, $detected) !== false) { $found_reply = true; break; } } if ($found_reply || $msg->answered == 'A' || !isset($msg->body) || !isset($msg->size)) { continue; } $data_array[] = $msg; } } // põhiklassi extension, võimaldamaks päringust saadud väärtusi edasi töödelda class PTABLE_EXT extends PTABLE {