Rename Core\Conifg to $this->config
This commit is contained in:
parent
0f93a467a7
commit
dda26a46f5
52
src/App.php
52
src/App.php
|
@ -465,14 +465,14 @@ class App
|
|||
{
|
||||
$scheme = $this->scheme;
|
||||
|
||||
if (Core\Config::get('system', 'ssl_policy') == SSL_POLICY_FULL) {
|
||||
if ($this->config->get('system', 'ssl_policy') == SSL_POLICY_FULL) {
|
||||
$scheme = 'https';
|
||||
}
|
||||
|
||||
// Basically, we have $ssl = true on any links which can only be seen by a logged in user
|
||||
// (and also the login link). Anything seen by an outsider will have it turned off.
|
||||
|
||||
if (Core\Config::get('system', 'ssl_policy') == SSL_POLICY_SELFSIGN) {
|
||||
if ($this->config->get('system', 'ssl_policy') == SSL_POLICY_SELFSIGN) {
|
||||
if ($ssl) {
|
||||
$scheme = 'https';
|
||||
} else {
|
||||
|
@ -480,8 +480,8 @@ class App
|
|||
}
|
||||
}
|
||||
|
||||
if (Core\Config::get('config', 'hostname') != '') {
|
||||
$this->hostname = Core\Config::get('config', 'hostname');
|
||||
if ($this->config->get('config', 'hostname') != '') {
|
||||
$this->hostname = $this->config->get('config', 'hostname');
|
||||
}
|
||||
|
||||
return $scheme . '://' . $this->hostname . (!empty($this->getURLPath()) ? '/' . $this->getURLPath() : '' );
|
||||
|
@ -520,8 +520,8 @@ class App
|
|||
include $this->getBasePath() . '/.htpreconfig.php';
|
||||
}
|
||||
|
||||
if (Core\Config::get('config', 'hostname') != '') {
|
||||
$this->hostname = Core\Config::get('config', 'hostname');
|
||||
if ($this->config->get('config', 'hostname') != '') {
|
||||
$this->hostname = $this->config->get('config', 'hostname');
|
||||
}
|
||||
|
||||
if (!isset($this->hostname) || ($this->hostname == '')) {
|
||||
|
@ -532,8 +532,8 @@ class App
|
|||
|
||||
public function getHostName()
|
||||
{
|
||||
if (Core\Config::get('config', 'hostname') != '') {
|
||||
$this->hostname = Core\Config::get('config', 'hostname');
|
||||
if ($this->config->get('config', 'hostname') != '') {
|
||||
$this->hostname = $this->config->get('config', 'hostname');
|
||||
}
|
||||
|
||||
return $this->hostname;
|
||||
|
@ -583,12 +583,12 @@ class App
|
|||
|
||||
$this->registerStylesheet($stylesheet);
|
||||
|
||||
$shortcut_icon = Core\Config::get('system', 'shortcut_icon');
|
||||
$shortcut_icon = $this->config->get('system', 'shortcut_icon');
|
||||
if ($shortcut_icon == '') {
|
||||
$shortcut_icon = 'images/friendica-32.png';
|
||||
}
|
||||
|
||||
$touch_icon = Core\Config::get('system', 'touch_icon');
|
||||
$touch_icon = $this->config->get('system', 'touch_icon');
|
||||
if ($touch_icon == '') {
|
||||
$touch_icon = 'images/friendica-128.png';
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ class App
|
|||
'$update_interval' => $interval,
|
||||
'$shortcut_icon' => $shortcut_icon,
|
||||
'$touch_icon' => $touch_icon,
|
||||
'$block_public' => intval(Core\Config::get('system', 'block_public')),
|
||||
'$block_public' => intval($this->config->get('system', 'block_public')),
|
||||
'$stylesheets' => $this->stylesheets,
|
||||
]) . $this->page['htmlhead'];
|
||||
}
|
||||
|
@ -781,13 +781,13 @@ class App
|
|||
*
|
||||
if ($this->is_backend()) {
|
||||
$process = 'backend';
|
||||
$max_processes = Core\Config::get('system', 'max_processes_backend');
|
||||
$max_processes = $this->config->get('system', 'max_processes_backend');
|
||||
if (intval($max_processes) == 0) {
|
||||
$max_processes = 5;
|
||||
}
|
||||
} else {
|
||||
$process = 'frontend';
|
||||
$max_processes = Core\Config::get('system', 'max_processes_frontend');
|
||||
$max_processes = $this->config->get('system', 'max_processes_frontend');
|
||||
if (intval($max_processes) == 0) {
|
||||
$max_processes = 20;
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ class App
|
|||
*/
|
||||
public function isMinMemoryReached()
|
||||
{
|
||||
$min_memory = Core\Config::get('system', 'min_memory', 0);
|
||||
$min_memory = $this->config->get('system', 'min_memory', 0);
|
||||
if ($min_memory == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -861,13 +861,13 @@ class App
|
|||
{
|
||||
if ($this->isBackend()) {
|
||||
$process = 'backend';
|
||||
$maxsysload = intval(Core\Config::get('system', 'maxloadavg'));
|
||||
$maxsysload = intval($this->config->get('system', 'maxloadavg'));
|
||||
if ($maxsysload < 1) {
|
||||
$maxsysload = 50;
|
||||
}
|
||||
} else {
|
||||
$process = 'frontend';
|
||||
$maxsysload = intval(Core\Config::get('system', 'maxloadavg_frontend'));
|
||||
$maxsysload = intval($this->config->get('system', 'maxloadavg_frontend'));
|
||||
if ($maxsysload < 1) {
|
||||
$maxsysload = 50;
|
||||
}
|
||||
|
@ -933,7 +933,7 @@ class App
|
|||
*/
|
||||
public function getSenderEmailAddress()
|
||||
{
|
||||
$sender_email = Core\Config::get('config', 'sender_email');
|
||||
$sender_email = $this->config->get('config', 'sender_email');
|
||||
if (empty($sender_email)) {
|
||||
$hostname = $this->getHostName();
|
||||
if (strpos($hostname, ':')) {
|
||||
|
@ -977,7 +977,7 @@ class App
|
|||
*/
|
||||
private function computeCurrentTheme()
|
||||
{
|
||||
$system_theme = Core\Config::get('system', 'theme');
|
||||
$system_theme = $this->config->get('system', 'theme');
|
||||
if (!$system_theme) {
|
||||
throw new Exception(Core\L10n::t('No system theme config value set.'));
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ class App
|
|||
// Sane default
|
||||
$this->currentTheme = $system_theme;
|
||||
|
||||
$allowed_themes = explode(',', Core\Config::get('system', 'allowed_themes', $system_theme));
|
||||
$allowed_themes = explode(',', $this->config->get('system', 'allowed_themes', $system_theme));
|
||||
|
||||
$page_theme = null;
|
||||
// Find the theme that belongs to the user whose stuff we are looking at
|
||||
|
@ -1002,7 +1002,7 @@ class App
|
|||
|
||||
// Specific mobile theme override
|
||||
if (($this->is_mobile || $this->is_tablet) && Core\Session::get('show-mobile', true)) {
|
||||
$system_mobile_theme = Core\Config::get('system', 'mobile-theme');
|
||||
$system_mobile_theme = $this->config->get('system', 'mobile-theme');
|
||||
$user_mobile_theme = Core\Session::get('mobile-theme', $system_mobile_theme);
|
||||
|
||||
// --- means same mobile theme as desktop
|
||||
|
@ -1073,7 +1073,7 @@ class App
|
|||
*/
|
||||
public function checkURL()
|
||||
{
|
||||
$url = Core\Config::get('system', 'url');
|
||||
$url = $this->config->get('system', 'url');
|
||||
|
||||
// if the url isn't set or the stored url is radically different
|
||||
// than the currently visited url, store the current value accordingly.
|
||||
|
@ -1082,7 +1082,7 @@ class App
|
|||
// We will only change the url to an ip address if there is no existing setting
|
||||
|
||||
if (empty($url) || (!Util\Strings::compareLink($url, $this->getBaseURL())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $this->getHostName()))) {
|
||||
Core\Config::set('system', 'url', $this->getBaseURL());
|
||||
$this->config->set('system', 'url', $this->getBaseURL());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1115,8 +1115,8 @@ class App
|
|||
|
||||
if (!$this->getMode()->isInstall()) {
|
||||
// Force SSL redirection
|
||||
if (Core\Config::get('system', 'force_ssl') && ($this->getScheme() == "http")
|
||||
&& intval(Core\Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL
|
||||
if ($this->config->get('system', 'force_ssl') && ($this->getScheme() == "http")
|
||||
&& intval($this->config->get('system', 'ssl_policy')) == SSL_POLICY_FULL
|
||||
&& strpos($this->getBaseURL(), 'https://') === 0
|
||||
&& $_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
header('HTTP/1.1 302 Moved Temporarily');
|
||||
|
@ -1256,7 +1256,7 @@ class App
|
|||
$this->module = "login";
|
||||
}
|
||||
|
||||
$privateapps = Core\Config::get('config', 'private_addons', false);
|
||||
$privateapps = $this->config->get('config', 'private_addons', false);
|
||||
if (Core\Addon::isEnabled($this->module) && file_exists("addon/{$this->module}/{$this->module}.php")) {
|
||||
//Check if module is an app and if public access to apps is allowed or not
|
||||
if ((!local_user()) && Core\Hook::isAddonApp($this->module) && $privateapps) {
|
||||
|
@ -1441,7 +1441,7 @@ class App
|
|||
header("X-Friendica-Version: " . FRIENDICA_VERSION);
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
if (Core\Config::get('system', 'hsts') && (Core\Config::get('system', 'ssl_policy') == SSL_POLICY_FULL)) {
|
||||
if ($this->config->get('system', 'hsts') && ($this->config->get('system', 'ssl_policy') == SSL_POLICY_FULL)) {
|
||||
header("Strict-Transport-Security: max-age=31536000");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue