X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=DataObjects%2FCore_ip_access.php;h=f803de0b52453c6b853ca7f828d455d48598be72;hp=bb59c7d97533aaac2b8386d33669c93d5f8abb7d;hb=HEAD;hpb=f387b4418842173bbfd4091ab5e4bb6e593e1bf1 diff --git a/DataObjects/Core_ip_access.php b/DataObjects/Core_ip_access.php index bb59c7d9..f803de0b 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 @@ -25,8 +28,38 @@ class Pman_Core_DataObjects_Core_ip_access extends DB_DataObject function sendXMPP() { + $ff = HTML_FlexyFramework::get(); + + if( + empty($ff->Pman['ip_management']) || + empty($ff->Pman['XMPP']) || + empty($ff->Pman['XMPP']['username']) || + empty($ff->Pman['XMPP']['password']) || + empty($ff->Pman['XMPP']['to']) || + empty($ff->Pman['XMPP']['url']) + ) { + return; + } + + 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->Pman['XMPP']['url']}/Core/VerifyAccess/{$this->id}/{$this->authorized_key}"; + + 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; } - }