3
function __construct() {
5
require_once($ADEI_ROOTDIR .'/includes/PHPMailer-Lite_v5.1/class.phpmailer-lite.php');
8
function createPNG($props){
10
$req = new DATARequest();
11
$fullpath = $ADEI_ROOTDIR . "tmp/tmpimg/";
14
foreach($props as $key => $value)
16
$req->SetProp($key,$value);
17
if ($key=='db_server' || $key=='db_name' || $key == 'window')
19
$picname .= $value ."-";
22
$picname .= rand(1,200);
24
$fullpath .= $picname;
26
$draw = $req->CreatePlotter();
28
$draw->Save($fullpath);
31
catch (ADEIException $ex) {
32
$ex->logInfo(NULL, $draw);
37
function listSensors($opts){
38
$req = new DATARequest($opts);
39
$reader = $req->CreateReader();
40
$groups = $reader->GetGroups();
41
$grouplist = $reader->GetGroupList();
42
$mask = new MASK($opts);
44
foreach($grouplist as $group => $details){
45
$itemlist[$det['gid']] = $reader->GetItemList($groups[$i],$mask);
48
foreach($itemlist as $gid => $items) {
49
if (!is_numeric($gid)) {
50
foreach($items as $key => $item ) {
51
$details['groups'][$gid][$key] = array("id" =>"{$item['id']}", "name" => "{$item['name']}");
58
function createFolder(){
59
$dir = $ADEI_ROOTDIR .'tmp/tmpimg';
61
if (@mkdir($dir, 0777, true)){
65
else return "Failure";
67
else return "Success";
70
function sendMail($props){
71
$mail = new PHPMailerLite(); // defaults to using php "Sendmail" (or Qmail, depending on availability)
72
$mail->IsMail(); // telling the class to use native PHP mail()
74
$mail->SetFrom('adei@adei.com', 'Adei User');
75
$mail->AddAddress($props['email'], 'User');
76
$mail->Subject = 'Adei Graph';
77
$mail->MsgHTML($props['message']);
78
$mail->AddAttachment($props['attachement']); // attachment
80
return $props['message'];
81
} catch (phpmailerException $e) {
82
return 'phpmailerException';//$e->errorMessage(); //Pretty error messages from PHPMailer
83
} catch (Exception $e) {
84
return 'exception';//$e->getMessage();//Boring error messages from anything else!
b'\\ No newline at end of file'