blob: 4483e1d8be6f72aa66d70a753487e133e1824287 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
<?php
/**
* Helper functions for getting info about the observer.
*
* SPDX-FileCopyrightText: 2025 The Hubzilla Community
* SPDX-FileContributor: Harald Eilertsen <haraldei@anduin.net>
*
* SPDX-License-Identifier: MIT
*
* The _observer_ in Hubzilla is the channel visiting the site in the current
* session. This could be a local channel, or a remote channel logged in via
* OpenWebAuth.
*
* If the observer is not set, or empty, this indicates an unauthenticated
* visitor, which may mean a visitor from another site that don't support, or
* has not enabled OpenWebAuth.
*/
/**
* Get the unique hash identifying the current observer.
*
* Observer can be a local or remote channel.
*
* @return string Unique hash of observer, otherwise empty string if no
* observer
*/
function get_observer_hash() {
$observer = App::get_observer();
if (is_array($observer)) {
return $observer['xchan_hash'];
}
return '';
}
/**
* Get the guid of the current observer.
*
* Observer can be a local or remote channel.
*
* @return string The GUID of the observer, otherwise empty string if no
* observer
*/
function get_observer_guid() {
$observer = App::get_observer();
if (is_array($observer)) {
return $observer['xchan_guid'];
}
return '';
}
/**
* Get the name of the current observer.
*
* Observer can be a local or remote channel.
*
* @return string The name of the observer, otherwise empty string if no
* observer
*/
function get_observer_name() {
$observer = App::get_observer();
if (is_array($observer)) {
return $observer['xchan_name'];
}
return '';
}
|