$view->name = $_GET['openid']; $ret = $view->render('identity.phtml'); } } else { if (isset($_GET['openid2'])) { $url = Zend_OpenId::selfURL() . '?openid=' . $_GET['openid2']; if ($server->hasUser($url)) { $view->server = Zend_OpenId::selfURL(); $view->name = $_GET['openid2']; $ret = $view->render('identity2.phtml'); } } else { if ($server->getLoggedInUser() !== false) { $view->url = $server->getLoggedInUser(); if ($server->hasUser($view->url)) { $sites = $server->getTrustedSites(); $s = ""; foreach ($sites as $site => $trusted) { if (is_bool($trusted) || is_array($trusted)) { $s .= trust_form($site, $trusted); } } if (empty($s)) { $s = "<tr><td>None</td></tr>"; } $view->sites = $s; $ret = $view->render('profile.phtml'); } } else { $ret = $view->render('login.phtml'); }
/** * testing getTrustedSites * */ public function testGetTrustedSites() { $storage = new Zend_OpenId_Provider_Storage_File(dirname(__FILE__) . "/_files/provider"); $storage->delUser(self::USER); $this->_user->delLoggedInUser(); $provider = new Zend_OpenId_Provider(null, null, $this->_user, $storage); $sreg = new Zend_OpenId_Extension_Sreg(array("nickname" => "test_id")); $this->assertTrue($provider->register(self::USER, self::PASSWORD)); $this->assertTrue($provider->login(self::USER, self::PASSWORD)); $this->assertTrue($provider->allowSite("http://www.test1.com/")); $this->assertTrue($provider->allowSite("http://www.test2.com/", $sreg)); $this->AssertSame(array('http://www.test1.com/' => true, 'http://www.test2.com/' => array('Zend_OpenId_Extension_Sreg' => array('nickname' => 'test_id'))), $provider->getTrustedSites()); $this->_user->delLoggedInUser(); $this->AssertFalse($provider->getTrustedSites()); $storage->delUser(self::USER); }