function abconfirm() { // the global address book connects here to find out if this // server really sent a request modifying ab AB entry $result = array(); $entityUrl = $_REQUEST['entity_url']; $checksum = $_REQUEST['checksum']; $thisEntity = new HubbubEntity(array('url' => $entityUrl)); if(sizeof($thisEntity->ds) == 0) { $result['error'] = 'invalid entity'; } else { $nvIdentifier = 'abreq/'.$thisEntity->ds['_key']; $reqInfo = h2_nv_retrieve($nvIdentifier, 'sys'); if($reqInfo['checksum'] != $checksum) { $result['error'] = 'invalid checksum'; } else { // remove the "pending" entry from the NV store h2_nv_store($nvIdentifier, null, 'sys'); // confirm to the address book that we did indeed make this request $result['result'] = 'OK'; } } print(json_encode($result)); }
function RemoteRegister($res, $entityDS, $active = 'yes') { $abData = h2_nv_retrieve('abdata'); $abData['active'] = $active; $abData['receipt'] = $res['receipt']; $abData['updated'] = time(); $abData['entry'] = $entityDS; h2_nv_store('abdata', $abData); }
$pingServer = cfg('ping/server'); if(!strStartsWith($pingServer, 'http://')) $pingServer = 'http://'.$pingServer; if(file_exists('log/cron.last.log')) { $btype = 'smallwin'; $lastPing = filectime('log/cron.last.log'); $lastPingText = 'Last ping: '.ageToString($lastPing, 'very recently'); } else { $btype = 'fail'; $lastPingText = 'Waiting for ping from '.$pingServer.'...'; } if(cfg('ping/remote') && cfg('ping/server') != '') { $pingStatus = h2_nv_retrieve('ping/status'); if($pingStatus['server'] != $pingServer) { $pingRequest = cqrequest($pingServer, array('origin' => 'http://'.cfg('service/server').'/cron.php', 'request' => 'activate', 'password' => cfg('ping/password')), 2); if($pingRequest['data']['result'] == 'OK') { $btype = 'win'; $lastPingText = 'Connection with ping server established, waiting for ping from '.$pingServer.'...'; $pingStatus = $pingRequest['data']; $pingStatus['server'] = $pingServer; h2_nv_store('ping/status', $pingStatus); @unlink('log/cron.last.log'); } else { $btype = 'fail';
function ajax_abstatus() { $this->skipView = false; $this->myEntry = $this->model->ABGetEntry($this->myEntity['url']); $this->reqStatus = h2_nv_retrieve('abreq/' . $this->myEntity['_key']); }