Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-candidate'
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zharkov committed Oct 8, 2013
2 parents fd66ba9 + b27c65a commit dc421b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions www/application/classes/controller/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function action_loginOAuth() {
$provider = OAuth::factory(DB_ORM::model('oauthprovider', array((int)$providerId)));
if($provider != null) {
Session::instance()->set('OAuthProviderId', $providerId);
Request::initial()->redirect($provider->getAuthorizeURL(URL::base(true, false) . 'home/loginOAuthCallback'));
Request::initial()->redirect($provider->getAuthorizeURL(URL::base(true, false, true) . 'home/loginOAuthCallback'));
}
}

Expand All @@ -59,7 +59,7 @@ public function action_loginOAuthCallback() {
if($providerId > 0) {
$provider = OAuth::factory(DB_ORM::model('oauthprovider', array((int)$providerId)));
if($provider != null) {
$token = $provider->getAccessToken($_REQUEST, URL::base(true, false) . 'home/loginOAuthCallback');
$token = $provider->getAccessToken($_REQUEST, URL::base(true, false, true) . 'home/loginOAuthCallback');
if($token != null) {
$userInfo = $provider->get($token, 'user-info');
$authorize = OAuth_Authorize::factory($provider->getName());
Expand All @@ -77,7 +77,7 @@ public function action_logout() {
if (Auth::instance()->logged_in()) {
Auth::instance()->logout();
}

Request::initial()->redirect(URL::base());
}

Expand Down
9 changes: 7 additions & 2 deletions www/system/classes/kohana/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Kohana_URL {
* @uses Kohana::$index_file
* @uses Request::protocol()
*/
public static function base($protocol = NULL, $index = FALSE)
public static function base($protocol = NULL, $index = FALSE, $addBaseUrl = false)
{
// Start with the configured base URL
$base_url = Kohana::$base_url;
Expand Down Expand Up @@ -87,7 +87,12 @@ public static function base($protocol = NULL, $index = FALSE)
}

// Add the protocol and domain to the base URL
$base_url = $protocol.'://'.$domain.$port.$base_url;
if ($addBaseUrl) {
$base_url = $protocol.'://'.$domain.$port.$base_url;
} else {
$base_url = $protocol.'://'.$domain.$port.'/';
}

}

return $base_url;
Expand Down

0 comments on commit dc421b0

Please sign in to comment.