public function getRPXObjectByTokenAndLogin($token) { $rpx = new RPX(); $response = $rpx->call('auth_info', array('token' => $token)); if ($response->stat == 'ok') { $identity = Doctrine::getTable('sfAuthIdentity')->findOneByUrl($response->profile->identifier); if ($identity) { $this->login($identity->getUser()); } } return $response; }
static function createByTokenAndUser($token, sfUser $user) { $rpx = new RPX(); $response = $rpx->call('auth_info', array('token' => $token)); if ($response->stat == 'ok') { //Save if not found already if (!Doctrine::getTable('sfAuthIdentity')->findOneByUrl($response->profile->identifier)) { //Assign $identity = new sfAuthIdentity(); $identity->sf_auth_user_id = $user->getId(); $identity->url = $response->profile->identifier; $identity->provider = $response->profile->providerName; //Save return $identity->save(); } return 'Identity already exists'; } return 'Could not retrieve user profile from partner'; }
$content .= _("User count") . ": ". statistics::user_count() . "<br />"; } $content .= _("Domain registration") . ": ". date("d.m.Y", $config_q["domain_registration_time"]) . "<br />"; $content .= _("Quotations add rate per day") . ": ". round( statistics::quote_count()/((time()-$config_q["domain_registration_time"])/3600/24), 1 ); $context["content"] = $content; break; case "shortcut": header("Location: ".quote::get_long_link_for_permalink($a_path[0]),TRUE,301); die(); break; case "contributors": $smarty_q->assign("h1", _("Quotation contributors")); $smarty_q->assign("fake_h1", _("Quotation contributors")); break; case "rpx_auth": $rpx_api = new RPX("12a3cf2d8a9ac5b12ccb865e91c2a75271977bc9", "https://quotebook-24.rpxnow.com/"); $response = $rpx_api->auth_info($_POST["token"]); $xpath = new DOMXPath($response); $displayName = $xpath->query("/rsp/profile/displayName")->item(0)->textContent; $identifier = $xpath->query('/rsp/profile/identifier')->item(0)->textContent; $email = $xpath->query('/rsp/profile/email')->item(0)->textContent; $profile = $xpath->query("/rsp/profile/*"); foreach($profile as $item) { arr($item->nodeName); arr($item->textContent); } break; case "manage_waitinglist": $smarty_q->assign("h1", "");
function http_post($url, $post_data) { if (function_exists('curl_init')) { $curl_result = RPX::curl_http_post($url, $post_data); // if the curl call errors out, which can happen for a number of reasons, // try the other method. if (!$curl_result) { $builtin_result = RPX::builtin_http_post($url, $post_data); return $builtin_result; } return $curl_result; } else { return RPX::builtin_http_post($url, $post_data); } }