use Friendica\Model\Contact;
-define('FRIENDICA_PLATFORM', 'Friendica');
-define('FRIENDICA_CODENAME', 'Giant Rhubarb');
-define('FRIENDICA_VERSION', '2022.12-dev');
-
/**
* Constant with a HTML line break.
*
*/
class App
{
+ const PLATFORM = 'Friendica';
+ const CODENAME = 'Giant Rhubarb';
+ const VERSION = '2022.12-dev';
+
// Allow themes to control internal parameters
// by changing App values in theme.php
private $theme_info = [
*/
public function registerStylesheet(string $path, string $media = 'screen')
{
- $path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
+ $path = Network::appendQueryParam($path, ['v' => App::VERSION]);
if (mb_strpos($path, $this->basePath . DIRECTORY_SEPARATOR) === 0) {
$path = mb_substr($path, mb_strlen($this->basePath . DIRECTORY_SEPARATOR));
*/
$this->page['htmlhead'] = Renderer::replaceMacros($tpl, [
'$local_user' => local_user(),
- '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
+ '$generator' => 'Friendica' . ' ' . App::VERSION,
'$delitem' => $l10n->t('Delete this item?'),
'$blockAuthor' => $l10n->t('Block this author? They won\'t be able to follow you nor see your public posts, and you won\'t be able to see their posts and their notifications.'),
'$update_interval' => $interval,
*/
public function registerFooterScript($path)
{
- $path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
+ $path = Network::appendQueryParam($path, ['v' => App::VERSION]);
$url = str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path);
$page = $this->page;
- header("X-Friendica-Version: " . FRIENDICA_VERSION);
+ header("X-Friendica-Version: " . App::VERSION);
header("Content-type: text/html; charset=utf-8");
if ($config->get('system', 'hsts') && ($baseURL->getSSLPolicy() == BaseURL::SSL_POLICY_FULL)) {
use Dice\Dice;
use Friendica;
+use Friendica\App;
/**
* Description of Console
$command = null;
if ($this->getOption('version')) {
- $this->out('Friendica Console version ' . FRIENDICA_VERSION);
+ $this->out('Friendica Console version ' . App::VERSION);
return 0;
} elseif ((count($this->options) === 0 || $this->getOption($this->customHelpOptions) === true || $this->getOption($this->customHelpOptions) === 1) && count($this->args) === 0
namespace Friendica\Module\Admin;
+use Friendica\App;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
'$page' => DI::l10n()->t('Federation Statistics'),
'$intro' => $intro,
'$counts' => $counts,
- '$version' => FRIENDICA_VERSION,
+ '$version' => App::VERSION,
'$legendtext' => DI::l10n()->tt('Currently this node is aware of %2$s node (%3$s active users last month, %4$s active users last six months, %5$s registered users in total) from the following platforms:', 'Currently this node is aware of %2$s nodes (%3$s active users last month, %4$s active users last six months, %5$s registered users in total) from the following platforms:', $total, number_format($total), number_format($month), number_format($halfyear), number_format($users)),
]);
}
namespace Friendica\Module\Admin;
+use Friendica\App;
use Friendica\Core\Addon;
use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Core\Logger;
// the local version of Friendica. Check is opt-in, source may be stable or develop branch
if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') {
$gitversion = DI::config()->get('system', 'git_friendica_version');
- if (version_compare(FRIENDICA_VERSION, $gitversion) < 0) {
- $warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', FRIENDICA_VERSION, $gitversion);
+ if (version_compare(App::VERSION, $gitversion) < 0) {
+ $warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', App::VERSION, $gitversion);
}
}
'$users' => [DI::l10n()->t('Registered users'), $users],
'$accounts' => $accounts,
'$pending' => [DI::l10n()->t('Pending registrations'), $pending],
- '$version' => [DI::l10n()->t('Version'), FRIENDICA_VERSION],
- '$platform' => FRIENDICA_PLATFORM,
- '$codename' => FRIENDICA_CODENAME,
+ '$version' => [DI::l10n()->t('Version'), App::VERSION],
+ '$platform' => App::PLATFORM,
+ '$codename' => App::CODENAME,
'$build' => DI::config()->get('system', 'build'),
'$addons' => [DI::l10n()->t('Active addons'), Addon::getEnabledList()],
'$serversettings' => $server_settings,
'sslserver' => null,
'ssl' => DI::config()->get('system', 'ssl_policy') == App\BaseURL::SSL_POLICY_FULL ? 'always' : '0',
'friendica' => [
- 'FRIENDICA_PLATFORM' => FRIENDICA_PLATFORM,
- 'FRIENDICA_VERSION' => FRIENDICA_VERSION,
- 'DB_UPDATE_VERSION' => DB_UPDATE_VERSION,
+ 'FRIENDICA_PLATFORM' => App::PLATFORM,
+ 'FRIENDICA_VERSION' => App::VERSION,
+ 'DB_UPDATE_VERSION' => App::VERSION,
]
],
];
namespace Friendica\Module;
+use Friendica\App;
use Friendica\BaseModule;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
return Renderer::replaceMacros($tpl, [
'about' => DI::l10n()->t('This is Friendica, version %s that is running at the web location %s. The database version is %s, the post update version is %s.',
- '<strong>' . FRIENDICA_VERSION . '</strong>',
+ '<strong>' . App::VERSION . '</strong>',
DI::baseUrl()->get(),
'<strong>' . $config->get('system', 'build') . '/' . DB_UPDATE_VERSION . '</strong>',
'<strong>' . $config->get('system', 'post_update_version') . '/' . PostUpdate::VERSION . '</strong>'),
}
$data = [
- 'version' => FRIENDICA_VERSION,
+ 'version' => App::VERSION,
'url' => DI::baseUrl()->get(),
'addons' => $visible_addons,
'locked_features' => $locked_features,
'register_policy' => $register_policy,
'admin' => $admin,
'site_name' => $config->get('config', 'sitename'),
- 'platform' => strtolower(FRIENDICA_PLATFORM),
+ 'platform' => strtolower(App::PLATFORM),
'info' => $config->get('config', 'info'),
'no_scrape_url' => DI::baseUrl()->get() . '/noscrape',
];
'version' => '1.0',
'software' => [
'name' => 'friendica',
- 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
+ 'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
],
'protocols' => [
'inbound' => [
'version' => '2.0',
'software' => [
'name' => 'friendica',
- 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
+ 'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
],
'protocols' => ['dfrn', 'activitypub'],
'services' => Nodeinfo::getServices(),
'baseUrl' => $this->baseUrl->get(),
'name' => $this->config->get('config', 'sitename'),
'software' => 'friendica',
- 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
+ 'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
],
'organization' => Nodeinfo::getOrganization($this->config),
'protocols' => ['dfrn', 'activitypub'],
namespace Friendica\Module\Settings;
+use Friendica\App;
use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
-use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Post;
);
$output = [
- 'version' => FRIENDICA_VERSION,
+ 'version' => App::VERSION,
'schema' => DB_UPDATE_VERSION,
'baseurl' => DI::baseUrl(),
'user' => $user,
$statistics = array_merge([
'name' => $this->config->get('config', 'sitename'),
- 'network' => FRIENDICA_PLATFORM,
- 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
+ 'network' => App::PLATFORM,
+ 'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
'registrations_open' => $registration_open,
'total_users' => $this->config->get('nodeinfo', 'total_users'),
'active_users_halfyear' => $this->config->get('nodeinfo', 'active_users_halfyear'),
$logger->notice('Curl redirect.', ['url' => $request->getUri(), 'to' => $uri, 'method' => $request->getMethod()]);
};
- $userAgent = FRIENDICA_PLATFORM . " '" .
- FRIENDICA_CODENAME . "' " .
- FRIENDICA_VERSION . '-' .
+ $userAgent = App::PLATFORM . " '" .
+ App::CODENAME . "' " .
+ App::VERSION . '-' .
DB_UPDATE_VERSION . '; ' .
$this->baseUrl->get();
namespace Friendica\Object\Api\Mastodon;
+use Friendica\App;
use Friendica\App\BaseURL;
use Friendica\BaseDataTransferObject;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Database\Database;
-use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\User;
use Friendica\Module\Register;
$this->title = $config->get('config', 'sitename');
$this->short_description = $this->description = $config->get('config', 'info');
$this->email = $config->get('config', 'admin_email');
- $this->version = '2.8.0 (compatible; Friendica ' . FRIENDICA_VERSION . ')';
+ $this->version = '2.8.0 (compatible; Friendica ' . App::VERSION . ')';
$this->urls = null; // Not supported
$this->stats = new Stats($config, $database);
$this->thumbnail = $baseUrl->get() . ($config->get('system', 'shortcut_icon') ?? 'images/friendica-32.png');
namespace Friendica\Protocol\ActivityPub;
+use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Cache\Enum\Duration;
{
return [
'type' => 'Service',
- 'name' => FRIENDICA_PLATFORM . " '" . FRIENDICA_CODENAME . "' " . FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
+ 'name' => App::PLATFORM . " '" . App::CODENAME . "' " . App::VERSION . '-' . DB_UPDATE_VERSION,
'url' => DI::baseUrl()->get()
];
}
use DOMElement;
use DOMNode;
use DOMXPath;
+use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
XML::addElement($doc, $root, 'id', DI::baseUrl() . '/profile/' . $owner['nick']);
XML::addElement($doc, $root, 'title', $owner['name']);
- $attributes = ['uri' => 'https://friendi.ca', 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION];
- XML::addElement($doc, $root, 'generator', FRIENDICA_PLATFORM, $attributes);
+ $attributes = ['uri' => 'https://friendi.ca', 'version' => App::VERSION . '-' . DB_UPDATE_VERSION];
+ XML::addElement($doc, $root, 'generator', App::PLATFORM, $attributes);
$attributes = ['rel' => 'license', 'href' => 'http://creativecommons.org/licenses/by/3.0/'];
XML::addElement($doc, $root, 'link', '', $attributes);
use DOMDocument;
use DOMElement;
use DOMXPath;
+use Friendica\App;
use Friendica\Content\PageInfo;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
break;
}
- $attributes = ['uri' => 'https://friendi.ca', 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION];
- XML::addElement($doc, $root, 'generator', FRIENDICA_PLATFORM, $attributes);
+ $attributes = ['uri' => 'https://friendi.ca', 'version' => App::VERSION . '-' . DB_UPDATE_VERSION];
+ XML::addElement($doc, $root, 'generator', App::PLATFORM, $attributes);
XML::addElement($doc, $root, 'id', DI::baseUrl() . '/profile/' . $owner['nick']);
XML::addElement($doc, $root, 'title', $title);
XML::addElement($doc, $root, 'subtitle', sprintf("Updates from %s on %s", $owner['name'], DI::config()->get('config', 'sitename')));
use DOMDocument;
use DOMElement;
use DOMXPath;
+use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Cache\Enum\Duration;
$attributes = [
'uri' => 'https://friendi.ca',
- 'version' => FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
+ 'version' => App::VERSION . '-' . DB_UPDATE_VERSION,
];
- XML::addElement($doc, $root, 'generator', FRIENDICA_PLATFORM, $attributes);
+ XML::addElement($doc, $root, 'generator', App::PLATFORM, $attributes);
XML::addElement($doc, $root, 'id', DI::baseUrl() . '/profile/' . $owner['nick']);
XML::addElement($doc, $root, 'title', $title);
XML::addElement($doc, $root, 'subtitle', sprintf("Updates from %s on %s", $owner['name'], DI::config()->get('config', 'sitename')));
namespace Friendica\Util\EMailer;
use Exception;
+use Friendica\App;
use Friendica\App\BaseURL;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
$this->headers = [
'Precedence' => ['list'],
'X-Friendica-Host' => [$hostname],
- 'X-Friendica-Platform' => [FRIENDICA_PLATFORM],
- 'X-Friendica-Version' => [FRIENDICA_VERSION],
+ 'X-Friendica-Platform' => [App::PLATFORM],
+ 'X-Friendica-Version' => [App::VERSION],
'List-ID' => ['<notification.' . $hostname . '>'],
'List-Archive' => ['<' . $baseUrl->get() . '/notifications/system>'],
];
$tpl = Renderer::getMarkupTemplate('email/html.tpl');
$msgHtml = Renderer::replaceMacros($tpl, [
'$title' => $this->l10n->t('Friendica Notification'),
- '$product' => FRIENDICA_PLATFORM,
+ '$product' => App::PLATFORM,
'$htmlversion' => $msgHtml,
'$sitename' => $this->config->get('config', 'sitename'),
'$banner' => $this->config->get('system', 'email_banner',
namespace Friendica\Util\Writer;
use Exception;
+use Friendica\App;
use Friendica\Database\Definition\DbaDefinition;
/**
public static function create(DbaDefinition $definition): string
{
$sqlString = "-- ------------------------------------------\n";
- $sqlString .= "-- " . FRIENDICA_PLATFORM . " " . FRIENDICA_VERSION . " (" . FRIENDICA_CODENAME . ")\n";
+ $sqlString .= "-- " . App::PLATFORM . " " . App::VERSION . " (" . App::CODENAME . ")\n";
$sqlString .= "-- DB_UPDATE_VERSION " . DB_UPDATE_VERSION . "\n";
$sqlString .= "-- ------------------------------------------\n\n\n";
namespace Friendica\Test\src\Module;
+use Friendica\App;
use Friendica\Capabilities\ICanCreateResponses;
use Friendica\DI;
use Friendica\Module\NodeInfo110;
use Friendica\Module\NodeInfo120;
use Friendica\Module\NodeInfo210;
-use Friendica\Module\Response;
use Friendica\Test\FixtureTest;
class NodeInfoTest extends FixtureTest
self::assertEquals('1.0', $json->version);
self::assertEquals('friendica', $json->software->name);
- self::assertEquals(FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION, $json->software->version);
+ self::assertEquals(App::VERSION . '-' . DB_UPDATE_VERSION, $json->software->version);
self::assertIsArray($json->protocols->inbound);
self::assertIsArray($json->protocols->outbound);
self::assertEquals('2.0', $json->version);
self::assertEquals('friendica', $json->software->name);
- self::assertEquals(FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION, $json->software->version);
+ self::assertEquals(App::VERSION . '-' . DB_UPDATE_VERSION, $json->software->version);
self::assertIsArray($json->protocols);
self::assertIsArray($json->services->inbound);
self::assertEquals('1.0', $json->version);
self::assertEquals('friendica', $json->server->software);
- self::assertEquals(FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION, $json->server->version);
+ self::assertEquals(App::VERSION . '-' . DB_UPDATE_VERSION, $json->server->version);
self::assertIsArray($json->protocols);
self::assertIsArray($json->services->inbound);