New function "isAuthenticated"

This commit is contained in:
Michael 2019-09-28 18:09:11 +00:00
parent 89f02a1125
commit 83b00ef308
26 changed files with 64 additions and 48 deletions

View file

@ -13,6 +13,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Session;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Network\Probe;
@ -2679,7 +2680,7 @@ class Contact extends BaseObject
*/
public static function magicLink($contact_url, $url = '')
{
if (!local_user() && !remote_user()) {
if (!Session::isAuthenticated()) {
return $url ?: $contact_url; // Equivalent to: ($url != '') ? $url : $contact_url;
}
@ -2725,7 +2726,7 @@ class Contact extends BaseObject
{
$destination = $url ?: $contact['url']; // Equivalent to ($url != '') ? $url : $contact['url'];
if ((!local_user() && !remote_user()) || ($contact['network'] != Protocol::DFRN)) {
if (!Session::isAuthenticated() || ($contact['network'] != Protocol::DFRN)) {
return $destination;
}

View file

@ -3029,7 +3029,7 @@ class Item extends BaseObject
*/
public static function performLike($item_id, $verb)
{
if (!local_user() && !remote_user()) {
if (!Session::isAuthenticated()) {
return false;
}
@ -3428,7 +3428,7 @@ class Item extends BaseObject
}
// Update the cached values if there is no "zrl=..." on the links.
$update = (!local_user() && !remote_user() && ($item["uid"] == 0));
$update = (!Session::isAuthenticated() && ($item["uid"] == 0));
// Or update it if the current viewer is the intented viewer.
if (($item["uid"] == local_user()) && ($item["uid"] != 0)) {

View file

@ -215,7 +215,7 @@ class Profile
);
}
$block = ((Config::get('system', 'block_public') && !local_user() && !remote_user()) ? true : false);
$block = ((Config::get('system', 'block_public') && !Session::isAuthenticated()) ? true : false);
/**
* @todo
@ -448,7 +448,7 @@ class Profile
$about = !empty($profile['about']) ? L10n::t('About:') : false;
$xmpp = !empty($profile['xmpp']) ? L10n::t('XMPP:') : false;
if ((!empty($profile['hidewall']) || $block) && !local_user() && !remote_user()) {
if ((!empty($profile['hidewall']) || $block) && !Session::isAuthenticated()) {
$location = $gender = $marital = $homepage = $about = false;
}