now we're into the minor nitty fixes

This commit is contained in:
friendica 2013-01-21 19:56:39 -08:00
parent 4119e1f9cc
commit fb76675a28
4 changed files with 7 additions and 6 deletions

View File

@ -1186,7 +1186,7 @@ if(! function_exists('local_user')) {
if(! function_exists('remote_user')) { if(! function_exists('remote_user')) {
function remote_user() { function remote_user() {
if((x($_SESSION,'authenticated')) && (x($_SESSION,'visitor_id'))) if((x($_SESSION,'authenticated')) && (x($_SESSION,'visitor_id')))
return intval($_SESSION['visitor_id']); return $_SESSION['visitor_id'];
return false; return false;
} }
} }

View File

@ -63,9 +63,9 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
info( t('Logged out.') . EOL); info( t('Logged out.') . EOL);
goaway(z_root()); goaway(z_root());
} }
dbg(1);
if(x($_SESSION,'visitor_id') && (! x($_SESSION,'uid'))) { if(x($_SESSION,'visitor_id') && (! x($_SESSION,'uid'))) {
$r = q("select * from hubloc left join xchan on xchan_hash = hubloc_hash where hubloc_addr = '%s' limit 1", $r = q("select * from hubloc left join xchan on xchan_hash = hubloc_hash where hubloc_hash = '%s' limit 1",
dbesc($_SESSION['visitor_id']) dbesc($_SESSION['visitor_id'])
); );
if($r) { if($r) {
@ -77,7 +77,7 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p
} }
$a->set_groups(init_groups_visitor($_SESSION['visitor_id'])); $a->set_groups(init_groups_visitor($_SESSION['visitor_id']));
} }
dbg(0);
if(x($_SESSION,'uid') || x($_SESSION,'account_id')) { if(x($_SESSION,'uid') || x($_SESSION,'account_id')) {
// already logged in user returning // already logged in user returning

View File

@ -349,7 +349,7 @@ if(! function_exists('init_groups_visitor')) {
function init_groups_visitor($contact_id) { function init_groups_visitor($contact_id) {
$groups = array(); $groups = array();
$r = q("SELECT gid FROM group_member WHERE xchan = '%s' ", $r = q("SELECT gid FROM group_member WHERE xchan = '%s' ",
intval($contact_id) dbesc($contact_id)
); );
if(count($r)) { if(count($r)) {
foreach($r as $rr) foreach($r as $rr)

View File

@ -87,8 +87,9 @@ function post_init(&$a) {
$_SESSION['authenticated'] = 1; $_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $x[0]['xchan_hash']; $_SESSION['visitor_id'] = $x[0]['xchan_hash'];
$a->set_observer($x[0]); $a->set_observer($x[0]);
require_once('include/security.php');
$a->set_groups(init_groups_visitor($_SESSION['visitor_id'])); $a->set_groups(init_groups_visitor($_SESSION['visitor_id']));
notice(sprintf( t('Welcome %s. Remote authentication successful.'),$x[0]['xchan_name'])); info(sprintf( t('Welcome %s. Remote authentication successful.'),$x[0]['xchan_name']));
} }
} }