Merge branch 'develop' into rewrite/gravity-constants

This commit is contained in:
Roland Häder 2022-10-18 16:34:40 +02:00 committed by GitHub
commit 26e0469de7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
181 changed files with 2408 additions and 2405 deletions

View file

@ -40,6 +40,21 @@ use Friendica\Network\HTTPException;
class Community extends BaseModule
{
/**
* @name CP
*
* Type of the community page
* @{
*/
const DISABLED = -2;
const DISABLED_VISITOR = -1;
const LOCAL = 0;
const GLOBAL = 1;
const LOCAL_AND_GLOBAL = 2;
/**
* @}
*/
protected static $page_style;
protected static $content;
protected static $accountTypeString;
@ -69,7 +84,7 @@ class Community extends BaseModule
if (empty($_GET['mode']) || ($_GET['mode'] != 'raw')) {
$tabs = [];
if ((Session::isAuthenticated() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(DI::config()->get('system', 'singleuser'))) {
if ((Session::isAuthenticated() || in_array(self::$page_style, [self::LOCAL_AND_GLOBAL, self::LOCAL])) && empty(DI::config()->get('system', 'singleuser'))) {
$tabs[] = [
'label' => DI::l10n()->t('Local Community'),
'url' => 'community/local',
@ -80,7 +95,7 @@ class Community extends BaseModule
];
}
if (Session::isAuthenticated() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
if (Session::isAuthenticated() || in_array(self::$page_style, [self::LOCAL_AND_GLOBAL, self::GLOBAL])) {
$tabs[] = [
'label' => DI::l10n()->t('Global Community'),
'url' => 'community/global',
@ -140,7 +155,7 @@ class Community extends BaseModule
$items = self::getItems();
if (!DBA::isResult($items)) {
notice(DI::l10n()->t('No results.'));
DI::sysmsg()->addNotice(DI::l10n()->t('No results.'));
return $o;
}
@ -177,7 +192,7 @@ class Community extends BaseModule
self::$page_style = DI::config()->get('system', 'community_page_style');
if (self::$page_style == CP_NO_INTERNAL_COMMUNITY) {
if (self::$page_style == self::DISABLED) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
}
@ -191,7 +206,7 @@ class Community extends BaseModule
self::$content = 'global';
} else {
// When only the global community is allowed, we use this as default
self::$content = self::$page_style == CP_GLOBAL_COMMUNITY ? 'global' : 'local';
self::$content = self::$page_style == self::GLOBAL ? 'global' : 'local';
}
}
@ -201,14 +216,14 @@ class Community extends BaseModule
// Check if we are allowed to display the content to visitors
if (!Session::isAuthenticated()) {
$available = self::$page_style == CP_USERS_AND_GLOBAL;
$available = self::$page_style == self::LOCAL_AND_GLOBAL;
if (!$available) {
$available = (self::$page_style == CP_USERS_ON_SERVER) && (self::$content == 'local');
$available = (self::$page_style == self::LOCAL) && (self::$content == 'local');
}
if (!$available) {
$available = (self::$page_style == CP_GLOBAL_COMMUNITY) && (self::$content == 'global');
$available = (self::$page_style == self::GLOBAL) && (self::$content == 'global');
}
if (!$available) {

View file

@ -170,7 +170,7 @@ class Network extends BaseModule
if (self::$groupId) {
$group = DBA::selectFirst('group', ['name'], ['id' => self::$groupId, 'uid' => local_user()]);
if (!DBA::isResult($group)) {
notice(DI::l10n()->t('No such group'));
DI::sysmsg()->addNotice(DI::l10n()->t('No such group'));
}
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
@ -184,7 +184,7 @@ class Network extends BaseModule
'id' => DI::args()->get(0),
]) . $o;
} else {
notice(DI::l10n()->t('Invalid contact.'));
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid contact.'));
}
} elseif (!DI::config()->get('theme', 'hide_eventlist')) {
$o .= Profile::getBirthdays();