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;
|
$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';
|
$scheme = 'https';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basically, we have $ssl = true on any links which can only be seen by a logged in user
|
// 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.
|
// (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) {
|
if ($ssl) {
|
||||||
$scheme = 'https';
|
$scheme = 'https';
|
||||||
} else {
|
} else {
|
||||||
|
@ -480,8 +480,8 @@ class App
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Core\Config::get('config', 'hostname') != '') {
|
if ($this->config->get('config', 'hostname') != '') {
|
||||||
$this->hostname = Core\Config::get('config', 'hostname');
|
$this->hostname = $this->config->get('config', 'hostname');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $scheme . '://' . $this->hostname . (!empty($this->getURLPath()) ? '/' . $this->getURLPath() : '' );
|
return $scheme . '://' . $this->hostname . (!empty($this->getURLPath()) ? '/' . $this->getURLPath() : '' );
|
||||||
|
@ -520,8 +520,8 @@ class App
|
||||||
include $this->getBasePath() . '/.htpreconfig.php';
|
include $this->getBasePath() . '/.htpreconfig.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Core\Config::get('config', 'hostname') != '') {
|
if ($this->config->get('config', 'hostname') != '') {
|
||||||
$this->hostname = Core\Config::get('config', 'hostname');
|
$this->hostname = $this->config->get('config', 'hostname');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->hostname) || ($this->hostname == '')) {
|
if (!isset($this->hostname) || ($this->hostname == '')) {
|
||||||
|
@ -532,8 +532,8 @@ class App
|
||||||
|
|
||||||
public function getHostName()
|
public function getHostName()
|
||||||
{
|
{
|
||||||
if (Core\Config::get('config', 'hostname') != '') {
|
if ($this->config->get('config', 'hostname') != '') {
|
||||||
$this->hostname = Core\Config::get('config', 'hostname');
|
$this->hostname = $this->config->get('config', 'hostname');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->hostname;
|
return $this->hostname;
|
||||||
|
@ -583,12 +583,12 @@ class App
|
||||||
|
|
||||||
$this->registerStylesheet($stylesheet);
|
$this->registerStylesheet($stylesheet);
|
||||||
|
|
||||||
$shortcut_icon = Core\Config::get('system', 'shortcut_icon');
|
$shortcut_icon = $this->config->get('system', 'shortcut_icon');
|
||||||
if ($shortcut_icon == '') {
|
if ($shortcut_icon == '') {
|
||||||
$shortcut_icon = 'images/friendica-32.png';
|
$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 == '') {
|
if ($touch_icon == '') {
|
||||||
$touch_icon = 'images/friendica-128.png';
|
$touch_icon = 'images/friendica-128.png';
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ class App
|
||||||
'$update_interval' => $interval,
|
'$update_interval' => $interval,
|
||||||
'$shortcut_icon' => $shortcut_icon,
|
'$shortcut_icon' => $shortcut_icon,
|
||||||
'$touch_icon' => $touch_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,
|
'$stylesheets' => $this->stylesheets,
|
||||||
]) . $this->page['htmlhead'];
|
]) . $this->page['htmlhead'];
|
||||||
}
|
}
|
||||||
|
@ -781,13 +781,13 @@ class App
|
||||||
*
|
*
|
||||||
if ($this->is_backend()) {
|
if ($this->is_backend()) {
|
||||||
$process = '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) {
|
if (intval($max_processes) == 0) {
|
||||||
$max_processes = 5;
|
$max_processes = 5;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$process = 'frontend';
|
$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) {
|
if (intval($max_processes) == 0) {
|
||||||
$max_processes = 20;
|
$max_processes = 20;
|
||||||
}
|
}
|
||||||
|
@ -814,7 +814,7 @@ class App
|
||||||
*/
|
*/
|
||||||
public function isMinMemoryReached()
|
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) {
|
if ($min_memory == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -861,13 +861,13 @@ class App
|
||||||
{
|
{
|
||||||
if ($this->isBackend()) {
|
if ($this->isBackend()) {
|
||||||
$process = 'backend';
|
$process = 'backend';
|
||||||
$maxsysload = intval(Core\Config::get('system', 'maxloadavg'));
|
$maxsysload = intval($this->config->get('system', 'maxloadavg'));
|
||||||
if ($maxsysload < 1) {
|
if ($maxsysload < 1) {
|
||||||
$maxsysload = 50;
|
$maxsysload = 50;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$process = 'frontend';
|
$process = 'frontend';
|
||||||
$maxsysload = intval(Core\Config::get('system', 'maxloadavg_frontend'));
|
$maxsysload = intval($this->config->get('system', 'maxloadavg_frontend'));
|
||||||
if ($maxsysload < 1) {
|
if ($maxsysload < 1) {
|
||||||
$maxsysload = 50;
|
$maxsysload = 50;
|
||||||
}
|
}
|
||||||
|
@ -933,7 +933,7 @@ class App
|
||||||
*/
|
*/
|
||||||
public function getSenderEmailAddress()
|
public function getSenderEmailAddress()
|
||||||
{
|
{
|
||||||
$sender_email = Core\Config::get('config', 'sender_email');
|
$sender_email = $this->config->get('config', 'sender_email');
|
||||||
if (empty($sender_email)) {
|
if (empty($sender_email)) {
|
||||||
$hostname = $this->getHostName();
|
$hostname = $this->getHostName();
|
||||||
if (strpos($hostname, ':')) {
|
if (strpos($hostname, ':')) {
|
||||||
|
@ -977,7 +977,7 @@ class App
|
||||||
*/
|
*/
|
||||||
private function computeCurrentTheme()
|
private function computeCurrentTheme()
|
||||||
{
|
{
|
||||||
$system_theme = Core\Config::get('system', 'theme');
|
$system_theme = $this->config->get('system', 'theme');
|
||||||
if (!$system_theme) {
|
if (!$system_theme) {
|
||||||
throw new Exception(Core\L10n::t('No system theme config value set.'));
|
throw new Exception(Core\L10n::t('No system theme config value set.'));
|
||||||
}
|
}
|
||||||
|
@ -985,7 +985,7 @@ class App
|
||||||
// Sane default
|
// Sane default
|
||||||
$this->currentTheme = $system_theme;
|
$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;
|
$page_theme = null;
|
||||||
// Find the theme that belongs to the user whose stuff we are looking at
|
// Find the theme that belongs to the user whose stuff we are looking at
|
||||||
|
@ -1002,7 +1002,7 @@ class App
|
||||||
|
|
||||||
// Specific mobile theme override
|
// Specific mobile theme override
|
||||||
if (($this->is_mobile || $this->is_tablet) && Core\Session::get('show-mobile', true)) {
|
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);
|
$user_mobile_theme = Core\Session::get('mobile-theme', $system_mobile_theme);
|
||||||
|
|
||||||
// --- means same mobile theme as desktop
|
// --- means same mobile theme as desktop
|
||||||
|
@ -1073,7 +1073,7 @@ class App
|
||||||
*/
|
*/
|
||||||
public function checkURL()
|
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
|
// if the url isn't set or the stored url is radically different
|
||||||
// than the currently visited url, store the current value accordingly.
|
// 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
|
// 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()))) {
|
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()) {
|
if (!$this->getMode()->isInstall()) {
|
||||||
// Force SSL redirection
|
// Force SSL redirection
|
||||||
if (Core\Config::get('system', 'force_ssl') && ($this->getScheme() == "http")
|
if ($this->config->get('system', 'force_ssl') && ($this->getScheme() == "http")
|
||||||
&& intval(Core\Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL
|
&& intval($this->config->get('system', 'ssl_policy')) == SSL_POLICY_FULL
|
||||||
&& strpos($this->getBaseURL(), 'https://') === 0
|
&& strpos($this->getBaseURL(), 'https://') === 0
|
||||||
&& $_SERVER['REQUEST_METHOD'] == 'GET') {
|
&& $_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||||
header('HTTP/1.1 302 Moved Temporarily');
|
header('HTTP/1.1 302 Moved Temporarily');
|
||||||
|
@ -1256,7 +1256,7 @@ class App
|
||||||
$this->module = "login";
|
$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")) {
|
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
|
//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) {
|
if ((!local_user()) && Core\Hook::isAddonApp($this->module) && $privateapps) {
|
||||||
|
@ -1441,7 +1441,7 @@ class App
|
||||||
header("X-Friendica-Version: " . FRIENDICA_VERSION);
|
header("X-Friendica-Version: " . FRIENDICA_VERSION);
|
||||||
header("Content-type: text/html; charset=utf-8");
|
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");
|
header("Strict-Transport-Security: max-age=31536000");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue