public function isloggedinAction() { if (trim($_SERVER['REQUEST_METHOD']) === "GET") { if ($this->session->isLocked()) { $this->session->unLock(); } session_write_close(); } $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $res = "0"; header('Access-Control-Allow-Origin: *'); if ($this->session && isset($this->session->developsession) && $this->session->developsession === true) { if ($this->session->userid) { $res = "1"; } } if ($res === "0") { $source = SamlAuth::isAuthenticated(); } if ($source !== false) { $res = "1"; if (isset($_GET['profile']) && $_GET['profile'] === 'attributes' && $this->isAllowedProfileDataDomain()) { header('Content-type: application/json'); $attrs = $source->getAttributes(); if ($attrs && count($attrs) > 0) { $sourceIdentifier = false; $uid = false; $userAccount = false; try { if (isset($attrs['idp:sourceIdentifier']) && count($attrs['idp:sourceIdentifier']) === 1) { $sourceIdentifier = $attrs['idp:sourceIdentifier'][0]; $sourceIdentifier = str_replace('-sp', '', $sourceIdentifier); } if (isset($attrs['idp:uid']) && count($attrs['idp:uid']) === 1) { $uid = $attrs['idp:uid'][0]; } if ($sourceIdentifier && $uid) { $userAccount = SamlAuth::getUserAccount($uid, $sourceIdentifier); } if ($userAccount) { $attrs['entitlements'] = array('vo' => array('memberships' => VoAdmin::getUserMembership($userAccount->researcherid))); } } catch (Exception $ex) { } } echo json_encode($attrs); return; } } echo $res; }
public function detailsAction() { $pplID = $this->_getParam("id"); trackPage('/people/details?id=' . $pplID, $this->_getParam("format")); if ($pplID == '') { $pplID = $this->session->lastPplID; } $this->_helper->layout->disableLayout(); $ppl = new Default_Model_Researchers(); if ($this->session->userid !== null) { if (userIsAdminOrManager($this->session->userid)) { $ppl->viewModerated = true; } } if ($this->_getParam("id") == "0") { $this->view->entry = new Default_Model_Researcher(); $this->view->entry->countryID = '0'; } else { if (is_numeric($pplID) === true) { $ppl->filter->id->equals($pplID); } else { if (substr($pplID, 0, 2) === "s:") { $pplCname = substr($pplID, 2); $ppl->filter->cname->ilike($pplCname); } } $ppl->refresh($this->_getParam('format'), $this->_getParam('userid')); if (count($ppl->items) > 0) { $this->view->entry = $ppl->items[0]; $pplID = $this->view->entry->id; } // BEGIN: API logging hack $cid = 0; // clientID: 0 --> appDB portal if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '') { $src = "'" . $_SERVER['REMOTE_ADDR'] . "'"; } else { $src = ''; } if (is_numeric($this->session->userid) && $this->view->entry) { // only log if we have a valid userid $sql = "INSERT INTO ppl_api_log (pplid, timestamp, researcherid, source, ip) VALUES (" . $pplID . ", NOW(), " . $this->session->userid . ", " . $cid . ", " . $src . ");"; db()->query($sql)->fetchAll(); } // END: API logging hack if (isnull($this->view->entry->image) === false) { $this->view->image = "/people/getimage?id=" . $this->view->entry->id . "&req=" . urlencode($this->view->entry->lastUpdated); } } $this->view->dialogCount = $_GET['dc']; $this->view->positionTypes = new Default_Model_PositionTypes(); $this->view->positionTypes->filter->orderBy('ord'); $this->view->countries = new Default_Model_Countries(); $this->view->countries->filter->orderBy('name'); $this->view->contactTypes = new Default_Model_ContactTypes(); if (isnull($this->_getParam("tab")) == false) { $this->view->selectedTab = $this->_getParam("tab"); } $this->view->session = $this->session; if ($this->session->username !== null && $this->session->userid !== null) { $users = new Default_Model_Researchers(); $users->filter->id->equals($this->session->userid); $this->view->user = $users->items[0]; } else { $this->view->user = null; } //Setup vo membership data $this->view->entryVoMemberShip = "[]"; $this->view->entryRelationsXml = EntityRelations::relationsToXml($this->view->entry->guid); if (is_null($this->view->entry) === false && is_numeric($this->view->entry->id) && intval($this->view->entry->id) > 0) { $this->view->entryVoMemberShip = html_entity_decode(VoAdmin::getUserMembership($this->view->entry, true)); } }