VerifyAccess.php
[Pman.Core] / VerifyAccess.php
1 <?php
2
3 require_once 'Pman.php';
4
5 class Pman_Core_VerifyAccess extends Pman
6 {
7     var $masterTemplate = 'master-verify-ip-access.html';
8     
9     /*
10      * This is a public page
11      */
12     function getAuth() 
13     {
14         return true;
15     }
16     
17     function get($id)
18     {
19         @list($id, $key) = explode('/', $id);
20         
21         if(empty($id) || empty($key)){
22             $this->jerr('Invalid URL');
23         }
24         
25         $core_ip_access = DB_DataObject::factory('core_ip_access');
26         
27         if(!$core_ip_access->get($id) || $core_ip_access->authorized_key != $key){
28             $this->jerr('This URL is broken');
29         }
30         
31         $ff = HTML_FlexyFramework::get();
32         
33         $core_person = DB_DataObject::factory('core_person');
34         
35         
36         $ff->Pman['XMPP']['to'] = 'edward@roojs.com'; // testing...
37         
38         if(
39                 empty($id) ||
40                 empty($key) ||
41                 empty($ff->Pman['ip_management']) || 
42                 empty($ff->Pman['XMPP']) ||
43                 empty($ff->Pman['XMPP']['to']) ||
44                 !$core_person->get('email', $ff->Pman['XMPP']['to']) ||
45                 !$core_ip_access->get($id) ||
46                 $core_ip_access->authorized_key != $key
47         ) {
48             $this->jerr('Invalid URL');
49         }
50         
51         return;
52         
53     }
54     
55 }