chat is a members only feature, there is no "guest" access.

This commit is contained in:
friendica 2014-01-29 18:19:19 -08:00
parent 0d326dfb45
commit c24aa824fe

View File

@ -39,20 +39,26 @@ function chat_init(&$a) {
function chat_content(&$a) { function chat_content(&$a) {
if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'chat')) { $observer = get_observer_hash();
if(! $observer) {
notice( t('Permission denied.') . EOL);
return;
}
if(! perm_is_allowed($a->profile['profile_uid'],$observer,'chat')) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return; return;
} }
if((argc() > 3) && intval(argv(2)) && (argv(3) === 'leave')) { if((argc() > 3) && intval(argv(2)) && (argv(3) === 'leave')) {
chatroom_leave(get_observer_hash(),$room_id,$_SERVER['REMOTE_ADDR']); chatroom_leave($observer,$room_id,$_SERVER['REMOTE_ADDR']);
goaway(z_root() . '/channel/' . argv(1)); goaway(z_root() . '/channel/' . argv(1));
} }
if(argc() > 2 && intval(argv(2))) { if(argc() > 2 && intval(argv(2))) {
$room_id = intval(argv(2)); $room_id = intval(argv(2));
$x = chatroom_enter(get_observer_hash(),$room_id,'online',$_SERVER['REMOTE_ADDR']); $x = chatroom_enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']);
if(! $x) if(! $x)
return; return;
$o = replace_macros(get_markup_template('chat.tpl'),array()); $o = replace_macros(get_markup_template('chat.tpl'),array());