public function testNetworkIds()
 {
     $params = array('session_key' => 'session-key', 'user' => '10000', 'nid' => '2', 'nuser' => '20000', 'in_iframe' => 0, 'in_canvas' => 1, 'time' => time(), 'added' => 1, 'api_key' => 'api-key');
     $_GET =& $params;
     $_GET['fb_sig'] = Facebook::generate_sig($_GET, 'secret');
     foreach ($_GET as $key => $value) {
         if (strncmp($key, 'fb_sig', 6) === 0) {
             continue;
         }
         $_GET['fb_sig_' . $key] = $value;
         unset($_GET[$key]);
     }
     $ringside = new RingsideApiClients('api-key', 'secret', 'http://localhost/web/url', 'http://localhost/server/url', 'http://localhost/social/url');
     $this->assertEquals('10000', $ringside->get_loggedin_user());
     $this->assertEquals('2', $ringside->get_network_id());
     $this->assertEquals('20000', $ringside->get_network_user());
 }
Пример #2
0
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
require_once 'ringside/api/clients/RingsideApiClients.php';
/**
 * Demonstrates how to perform identity mapping.
 *
 * @author Jason Kinner <*****@*****.**>
 */
error_log("Facebook params:");
error_log(var_export($_REQUEST, true));
$ringside = null;
if ($_REQUEST['fb_sig_nid'] == 'facebook') {
    error_log("Initializing Facebook client");
    $ringside = new RingsideApiClients('c392078dde1c96d4c019d60420fd07ab', '93694d948f9b1cf0d8567ccf7e67a860', 'http://www.facebook.com', 'http://api.facebook.com/restserver.php', 'http://68.39.18.144:8888/social');
} else {
    error_log("Initializing Ringside client");
    $ringside = new RingsideApiClients('c392078dde1c96d4c019d60420fd07ab', '93694d948f9b1cf0d8567ccf7e67a860', 'http://68.39.18.144:8888/web/', 'http://68.39.18.144:8888/api/restserver.php', 'http://68.39.18.144:8888/social');
}
// This will cause redirect if this user is not yet a principal
$ringside->require_network_login();
?>
You are principal <?php 
echo $ringside->get_network_user();
?>
 on <?php 
echo $ringside->get_network_id();
?>
<br/>
Your name on this network is <fb:name uid="loggedinuser" useyou="false"/>