2
header("Content-type: text/xml");
3
header("Cache-Control: no-cache, must-revalidate");
4
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
6
//require("../classes/email.php");
10
$ADEI->RequireClass("email");
13
function genEmailContent($props) {
14
$host = $_SERVER['HTTP_HOST'];
15
$location = $props['url'];
18
foreach($props as $key => $value)
20
if ($key != 'from' && $key != 'to' && $key != 'message' && $key != 'attachement' && $key != 'adei_session' && $key != 'task' && $key != 'service' && $key != 'url') {
21
$query .= "&". $key . "=" . $value;
24
$filearray = explode('/',$props['attachement']);
25
$file = $filearray[count($file)-1];
26
$url ="$location". "#" ."$query";
27
$message = "<html><head><title>Adei Graph</title></head><body><p>";
28
$message .= "<p>". $props['message'] ."</p>";
29
$message .= "<p><a href='". $url ."'>Link to Graph</a></p>";
30
$message .= "<p><img src='$file' /></p>";
31
$message .="</body></html>";
35
if (isset($_GET['task'])) {
36
switch ($_GET['task']) {
38
if (isset($_GET['to']) && isset($_GET['message']) && isset($_GET['from']) && isset($_GET['attachement'])) {
40
$path = $_GET['attachement'];
41
$from = $_GET['from'];
42
foreach($_GET as $key => $value)
44
$props[$key] = $value;
46
$msg = genEmailContent($props);
47
$vlues = array('email' => $mail, 'message'=>$msg, 'attachement'=>$path, 'from' => $from);
48
$result = $EMAIL->sendMail($vlues);
50
if ($result != 'phpmailerException' || $result != 'exception') unlink($path);
54
$pic .= $_GET['picname'];
55
foreach($_GET as $key => $value)
57
$props[$key] = $value;
59
$r = $EMAIL->createFolder();
60
if ($r!="Success") echo "FAIL";
62
$result = $EMAIL->createPNG($props);
63
if ($result!="FAILED") echo $ADEI_ROOTDIR ."". $result;
68
foreach($_GET as $key => $value) {
71
$details = $EMAIL->listSensors($opts);
72
$return = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result>";
73
if ($error = $details['error'])
75
$return .= "<value>". $details['error'] ."</value>";
78
// $return .= "<value>Success</value></result>";
79
foreach($details['groups'] as $gid => $itemlist) {
80
$return .= "<value><groupname>". $gid ."</groupname>";
81
foreach($itemlist as $item => $info) {
82
$return .= "<item><itemid>". $info['id'] ."</itemid><itemname>". $info['name'] ."</itemname></item>";
84
$return .= "</value>";
87
$return .="</result>";
91
$return = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result>";
92
$return .= "<heading>Emaili</heading>";
93
$return .= "<value name='From' id='from'/>";
94
$return .= "<value name='Recipient' id='tomail'/>";
95
$return .= "<value name='Message' id='message'/>";
96
$return .= "<value name=\"$result\" id='ressu'/>";
97
$return .= "</result>";
102
$return = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><result>";
103
$return .= "<heading>Email</heading>";
104
$return .= "<value name='From' id='from'/>";
105
$return .= "<value name='Recipient' id='tomail'/>";
106
$return .= "<value name='Message' id='message'/>";
107
$return .= "</result>";
b'\\ No newline at end of file'