aboutsummaryrefslogtreecommitdiffstats
path: root/include/security.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-10-03 22:28:19 -0700
committerfriendica <info@friendica.com>2012-10-03 22:28:19 -0700
commite124c9fa5ca046d48eb927fe80706cf6d42f6bff (patch)
tree8df07cdd9a21c977bc961328cdc6a2f161a82988 /include/security.php
parentd0f62d1219d035d92f3adb717d9fdbed03fa6dd5 (diff)
downloadvolse-hubzilla-e124c9fa5ca046d48eb927fe80706cf6d42f6bff.tar.gz
volse-hubzilla-e124c9fa5ca046d48eb927fe80706cf6d42f6bff.tar.bz2
volse-hubzilla-e124c9fa5ca046d48eb927fe80706cf6d42f6bff.zip
Can't see any posts currently - after the big shakeup, but we can now post top level activities and store them.
Diffstat (limited to 'include/security.php')
-rw-r--r--include/security.php40
1 files changed, 14 insertions, 26 deletions
diff --git a/include/security.php b/include/security.php
index a85787588..da58a65c3 100644
--- a/include/security.php
+++ b/include/security.php
@@ -25,32 +25,13 @@ function authenticate_success($user_record, $login_initial = false, $interactive
}
- $uid_to_load = (((x($_SESSION,'uid')) && (intval($_SESSION['uid']))) ? intval($_SESSION['uid']) : 0);
- if(! $uid_to_load)
- $uid_to_load = intval($a->account['account_default_channel']);
+ $uid_to_load = (((x($_SESSION,'uid')) && (intval($_SESSION['uid'])))
+ ? intval($_SESSION['uid'])
+ : intval($a->account['account_default_channel'])
+ );
if($uid_to_load) {
- $r = q("select * from channel where channel_id = %d and channel_account_id = %d limit 1",
- intval($uid_to_load),
- intval($a->account['account_id'])
- );
- if($r && count($r)) {
- $_SESSION['uid'] = intval($r[0]['channel_id']);
- $a->set_channel($r[0]);
- $_SESSION['theme'] = $r[0]['channel_theme'];
- date_default_timezone_set($r[0]['channel_timezone']);
- }
-
- $c = q("SELECT * FROM contact WHERE uid = %d AND self = 1 LIMIT 1",
- intval($r[0]['channel_id'])
- );
-
- if($c && count($c)) {
- $a->contact = $c[0];
- $a->cid = $c[0]['id'];
- $_SESSION['cid'] = $a->cid;
- }
-
+ change_channel($uid_to_load);
}
}
@@ -222,7 +203,7 @@ function can_write_wall(&$a,$owner) {
function change_channel($change_channel) {
- $r = false;
+ $ret = false;
if($change_channel) {
$r = q("select * from channel where channel_id = %d and channel_account_id = %d limit 1",
@@ -230,14 +211,21 @@ function change_channel($change_channel) {
intval(get_account_id())
);
if($r && count($r)) {
+ $hash = $r[0]['channel_hash'];
$_SESSION['uid'] = intval($r[0]['channel_id']);
get_app()->set_channel($r[0]);
$_SESSION['theme'] = $r[0]['channel_theme'];
date_default_timezone_set($r[0]['channel_timezone']);
+ $ret = $r[0];
}
+ $x = q("select * from xchan where xchan_hash = '%s' limit 1",
+ dbesc($hash)
+ );
+ if($x && count($x))
+ get_app()->set_observer($x[0]);
}
- return $r;
+ return $ret;
}