X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_ip_access.php;h=08686ff492e29475331a18fae861db8dfd3cfa54;hb=90a59907f5c1f8b608e60729e38b023c9c2b5946;hp=21a33b66e8089eecba6549dae5f3230764a32829;hpb=e3b16a04e4f4c73e6e94a60fd99894b284ebeef1;p=Pman.Core diff --git a/DataObjects/Core_ip_access.php b/DataObjects/Core_ip_access.php index 21a33b66..08686ff4 100644 --- a/DataObjects/Core_ip_access.php +++ b/DataObjects/Core_ip_access.php @@ -14,7 +14,10 @@ class Pman_Core_DataObjects_Core_ip_access extends DB_DataObject public $status; public $authorized_by; public $authorized_key; - + public $email; + public $expire_dt; + public $user_agent; + /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE @@ -23,8 +26,6 @@ class Pman_Core_DataObjects_Core_ip_access extends DB_DataObject } - var $template = 'ip_access_xmpp.html'; - function sendXMPP() { $ff = HTML_FlexyFramework::get(); @@ -39,12 +40,25 @@ class Pman_Core_DataObjects_Core_ip_access extends DB_DataObject return; } - $template_engine = new HTML_Template_Flexy(); - $template_engine->compile($this->masterTemplate); + require_once 'Net/XMPP.php'; + + $conn = new Net_XMPP('talk.google.com', 5222, $ff->Pman['XMPP']['username'], $ff->Pman['XMPP']['password'], 'xmpphp', 'gmail.com', $printlog=false, $loglevel=Net_XMPP_Log::LEVEL_VERBOSE); + + $url = "{$ff->baseURL}/Core/VerifyAccess/{$this->id}/{$this->authorized_key}"; - $fn = $this->tempName('html'); + try { + $conn->connect(); + $conn->processUntil('session_start'); + $conn->presence(); + $conn->message($ff->Pman['XMPP']['to'], "New IP Login Required\n{$url}"); + $conn->disconnect(); + + } catch(XMPPHP_Exception $e) { + $ff->page->jerr($e->getMessage()); + } + + return; - file_put_contents($fn, $template_engine->bufferedOutputObject($this, $this->elements)); }