Skip to content

Commit

Permalink
oauth redir
Browse files Browse the repository at this point in the history
  • Loading branch information
voitto committed Sep 2, 2009
1 parent 3304dd5 commit 5ac5a1c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
11 changes: 7 additions & 4 deletions app/omb/plugins/security.php
Expand Up @@ -681,10 +681,6 @@ function _oauth( &$vars ) {
if ($db->num_rows($result) == 1) {
// XXX subdomain upgrade
$redir = blog_url($b->nickname,true);
if (strpos($redir, '?') === false)
$redir .= '?';
else
$redir .= '&';
$redir .= 'oauth_login';
$redir .= "&oauth_token=".$_REQUEST['oauth_token'];
$content = '<script type="text/javascript">'."\n";
Expand Down Expand Up @@ -1012,6 +1008,13 @@ function facebook_login( &$vars ) {
$Person =& $db->model('Person');
$FacebookUser =& $db->model('FacebookUser');

if (empty($prefix) && in_array('invites',$db->tables)) {
$Invite =& $db->model( 'Invite' );
$result = $Invite->find_by( 'nickname', (string)$user->user->name );
if (!$result)
trigger_error('Sorry, you have not been invited yet '.environment('email_from'), E_USER_ERROR);
}

$faceuser = $FacebookUser->find_by( 'facebook_id',$_SESSION['fb_userid'] );

// a) facebook user exists, does not have a profile_id
Expand Down
23 changes: 11 additions & 12 deletions db/library/dbscript/_functions.php
Expand Up @@ -727,19 +727,18 @@ function base_url($return = false) {

// XXX subdomain upgrade
function blog_url($nickname,$return = false) {

global $request;

if (pretty_urls() && environment('subdomains'))
return 'http://'.$nickname . '.' . $request->domain;

$q = '?';

if (pretty_urls())
$q = '';

return base_url(true).$q.'twitter/'.$nickname;

if (pretty_urls() && environment('subdomains')) {
$base = 'http://'.$nickname . '.' . $request->domain;
} else {
$q = '?';
if (pretty_urls())
$q = '';
$base = base_url(true).$q.'twitter/'.$nickname;
}
if ( !( substr( $base, -1 ) == '/' ))
$base = $base . "/";
return $base;
}

/**
Expand Down
15 changes: 11 additions & 4 deletions db/library/urlshort/upload/includes/gen.php
Expand Up @@ -146,7 +146,7 @@ function get_next_id($last_id)
{
$pos = strlen($last_id) - $x;

if ( $last_id[$pos] != 'z' )
if ( $last_id[$pos] != 'Z' )
{
$next_id = $this->increment_id($last_id, $pos);
break; // <- kill the for loop once it finds a character
Expand Down Expand Up @@ -201,22 +201,29 @@ function append_id($id)
function increment_id($id, $pos)
{
$char = $id[$pos];

// add 1 to numeric values
if ( is_numeric($char) )
{
if ( $char < 9 )
{
$new_char = $char + 1;
}
else // if we're at 9, it's time to move to the alphabet
else // if we're at z, it's time to move to upper case
{
$new_char = 'a';
}
}
else // move it up the alphabet
{
$new_char = chr(ord($char) + 1);
if ( $char == 'z' )
{
$new_char = 'A';
}
else
{
$new_char = chr(ord($char) + 1);
}
}

$id[$pos] = $new_char;
Expand Down

0 comments on commit 5ac5a1c

Please sign in to comment.