Replace the direct access of config variables

This commit is contained in:
Michael 2017-01-17 19:21:46 +00:00
parent b935b57c66
commit 53393233c3
5 changed files with 25 additions and 18 deletions

View file

@ -19,6 +19,8 @@
require_once('include/autoloader.php'); require_once('include/autoloader.php');
use \Friendica\Core\Config;
require_once('include/config.php'); require_once('include/config.php');
require_once('include/network.php'); require_once('include/network.php');
require_once('include/plugin.php'); require_once('include/plugin.php');
@ -1475,9 +1477,7 @@ function system_unavailable() {
function clean_urls() { function clean_urls() {
$a = get_app(); $a = get_app();
// if($a->config['system']['clean_urls'])
return true; return true;
// return false;
} }
function z_path() { function z_path() {
@ -2041,16 +2041,18 @@ function current_theme(){
// $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet(); // $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
$is_mobile = $a->is_mobile || $a->is_tablet; $is_mobile = $a->is_mobile || $a->is_tablet;
$standard_system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : ''); $standard_system_theme = Config::get('system', 'theme', '');
$standard_theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $standard_system_theme); $standard_theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $standard_system_theme);
if($is_mobile) { if ($is_mobile) {
if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) { if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
$system_theme = $standard_system_theme; $system_theme = $standard_system_theme;
$theme_name = $standard_theme_name; $theme_name = $standard_theme_name;
} } else {
else { $system_theme = Config::get('system', 'mobile-theme', '');
$system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : $standard_system_theme); if ($system_theme == '') {
$system_theme = $standard_system_theme;
}
$theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme); $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
if($theme_name === '---') { if($theme_name === '---') {

View file

@ -5,6 +5,9 @@
* *
* @todo Automatically detect if incoming data is HTML or BBCode * @todo Automatically detect if incoming data is HTML or BBCode
*/ */
use \Friendica\Core\Config;
require_once('include/HTTPExceptions.php'); require_once('include/HTTPExceptions.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
@ -2696,11 +2699,11 @@
$logo = App::get_baseurl() . '/images/friendica-64.png'; $logo = App::get_baseurl() . '/images/friendica-64.png';
$email = $a->config['admin_email']; $email = $a->config['admin_email'];
$closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false'); $closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false');
$private = (($a->config['system']['block_public']) ? 'true' : 'false'); $private = ((Config::get('system', 'block_public')) ? 'true' : 'false');
$textlimit = (string) (($a->config['max_import_size']) ? $a->config['max_import_size'] : 200000); $textlimit = (string) (($a->config['max_import_size']) ? $a->config['max_import_size'] : 200000);
if($a->config['api_import_size']) if($a->config['api_import_size'])
$texlimit = string($a->config['api_import_size']); $texlimit = string($a->config['api_import_size']);
$ssl = (($a->config['system']['have_ssl']) ? 'true' : 'false'); $ssl = ((Config::get('system', 'have_ssl')) ? 'true' : 'false');
$sslserver = (($ssl === 'true') ? str_replace('http:','https:',App::get_baseurl()) : ''); $sslserver = (($ssl === 'true') ? str_replace('http:','https:',App::get_baseurl()) : '');
$config = array( $config = array(

View file

@ -4,6 +4,7 @@
* @brief Some functions for date and time related tasks. * @brief Some functions for date and time related tasks.
*/ */
use \Friendica\Core\Config;
/** /**
* @brief Two-level sort for timezones. * @brief Two-level sort for timezones.
@ -271,8 +272,9 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke
$lang = substr(get_browser_language(), 0, 2); $lang = substr(get_browser_language(), 0, 2);
// Check if the detected language is supported by the picker // Check if the detected language is supported by the picker
if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"))) if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"))) {
$lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en'); $lang = Config::get('system', 'language', 'en');
}
$o = ''; $o = '';
$dateformat = ''; $dateformat = '';

View file

@ -10,6 +10,8 @@
* *
*/ */
use \Friendica\Core\Config;
require_once("include/dba.php"); require_once("include/dba.php");
if(! function_exists('get_browser_language')) { if(! function_exists('get_browser_language')) {
@ -47,12 +49,12 @@ function get_browser_language() {
break; break;
} }
} }
if(isset($preferred)) if (isset($preferred)) {
return $preferred; return $preferred;
}
// in case none matches, get the system wide configured language, or fall back to English // in case none matches, get the system wide configured language, or fall back to English
$a = get_app(); return Config::get('system', 'language', 'en');
return ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
}} }}

View file

@ -224,9 +224,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) {
* *
*/ */
$a->config['system']['curl_timeout'] = 120; $res = post_url($dfrn_confirm, $params, null, $redirects, 120);
$res = post_url($dfrn_confirm,$params);
logger(' Confirm: received data: ' . $res, LOGGER_DATA); logger(' Confirm: received data: ' . $res, LOGGER_DATA);