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

@ -8,6 +8,7 @@ use Friendica\Content\Pager;
use Friendica\Content\Widget;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Session;
use Friendica\Core\Renderer;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
@ -25,8 +26,8 @@ class Directory extends BaseModule
$app = self::getApp();
$config = $app->getConfig();
if (($config->get('system', 'block_public') && !local_user() && !remote_user()) ||
($config->get('system', 'block_local_dir') && !local_user() && !remote_user())) {
if (($config->get('system', 'block_public') && !Session::isAuthenticated()) ||
($config->get('system', 'block_local_dir') && !Session::isAuthenticated())) {
throw new HTTPException\ForbiddenException(L10n::t('Public access denied.'));
}

View file

@ -4,6 +4,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Model\Item;
use Friendica\Core\Session;
use Friendica\Network\HTTPException;
use Friendica\Util\Strings;
@ -14,7 +15,7 @@ class Like extends BaseModule
{
public static function rawContent()
{
if (!local_user() && !remote_user()) {
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException();
}

View file

@ -10,6 +10,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
@ -19,7 +20,7 @@ class Contacts extends BaseModule
{
public static function content()
{
if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
throw new \Friendica\Network\HTTPException\NotFoundException(L10n::t('User not found.'));
}