/**
  * support both prompt_permissions.php and authorize.php for now.
  * authorized.php is to be deprecate though.
  */
 public function get_extended_permission_url($ext_perm, $next = null, $cancel_url = null)
 {
     $next = $next ? $next : parent::current_url();
     $cancel_url = $cancel_url ? $cancel_url : parent::current_url();
     return $this->get_m_url('authorize.php', array('api_key' => $this->api_key, 'ext_perm' => $ext_perm, 'next' => $next, 'cancel_url' => $cancel_url));
 }
 public function testNetworkRedirect()
 {
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['REQUEST_URI'] = '/web/url';
     $params = array('soc_session_key' => '', 'session_key' => 'session-key', 'user' => '10000', '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 RedirectingClient('api-key', 'secret', 'http://localhost/web/url', 'http://localhost/server/url', 'http://localhost/social/url');
     $this->assertEquals('10000', $ringside->get_loggedin_user());
     $this->assertNull($ringside->get_network_id());
     $this->assertNull($ringside->get_network_user());
     $ringside->require_network_login();
     // Confirm that the client forced a redirect; we don't care what PHP thinks the current URL is
     $this->assertEquals('http://localhost/social/url/map.php?v=1.0&method=map&api_key=api-key&snid=&sid=10000&social_session_key=&session_key=session-key&next=' . urlencode(Facebook::current_url()) . '&canvas', $ringside->redirect);
 }