aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-03-24 09:58:21 +0000
committerMario <mario@mariovavti.com>2024-03-24 09:58:21 +0000
commita0cfe22501dc9daa7dd8cff86803cf494a1f5ec3 (patch)
treee156db21df2251b8c67e61453c8f4af9f9460d2f /include
parentecdd9a4d6edd769a3e2c3b0604e4637d94fa1a51 (diff)
parent0dc959d9fe40bddce5e99b8162bb0e770fc28ed9 (diff)
downloadvolse-hubzilla-a0cfe22501dc9daa7dd8cff86803cf494a1f5ec3.tar.gz
volse-hubzilla-a0cfe22501dc9daa7dd8cff86803cf494a1f5ec3.tar.bz2
volse-hubzilla-a0cfe22501dc9daa7dd8cff86803cf494a1f5ec3.zip
Merge branch 'deprecate-include-config-in-core' into 'dev'
Deprecate *_config() functions in core. See merge request hubzilla/core!2114
Diffstat (limited to 'include')
-rw-r--r--include/account.php51
-rw-r--r--include/attach.php7
-rw-r--r--include/auth.php15
-rw-r--r--include/bbcode.php9
-rw-r--r--include/channel.php27
-rw-r--r--include/cli_startup.php4
-rw-r--r--include/config.php65
-rw-r--r--include/connections.php7
-rw-r--r--include/contact_widgets.php3
-rw-r--r--include/conversation.php5
-rw-r--r--include/crypto.php8
-rw-r--r--include/event.php3
-rw-r--r--include/features.php80
-rw-r--r--include/feedutils.php8
-rw-r--r--include/hubloc.php9
-rw-r--r--include/import.php3
-rw-r--r--include/items.php11
-rw-r--r--include/language.php7
-rw-r--r--include/nav.php13
-rw-r--r--include/network.php89
-rw-r--r--include/oauth.php60
-rw-r--r--include/oauth2.php10
-rw-r--r--include/oembed.php20
-rw-r--r--include/permissions.php8
-rw-r--r--include/photo/photo_driver.php7
-rw-r--r--include/photos.php9
-rw-r--r--include/plugin.php9
-rw-r--r--include/security.php4
-rw-r--r--include/socgraph.php3
-rw-r--r--include/statistics_fns.php22
-rw-r--r--include/taxonomy.php3
-rw-r--r--include/text.php21
-rw-r--r--include/zid.php3
33 files changed, 351 insertions, 252 deletions
diff --git a/include/account.php b/include/account.php
index a1fb0f159..884c07389 100644
--- a/include/account.php
+++ b/include/account.php
@@ -4,6 +4,7 @@
* @brief Somme account related functions.
*/
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Crypto;
require_once('include/config.php');
@@ -83,8 +84,8 @@ function check_account_invite($invite_code) {
$result = array('error' => false, 'message' => '');
// [hilmar ->
- $using_invites = (get_config('system','invitation_only')
- || get_config('system','invitation_also'));
+ $using_invites = (Config::Get('system','invitation_only')
+ || Config::Get('system','invitation_also'));
if($using_invites) {
@@ -118,7 +119,7 @@ function check_account_invite($invite_code) {
function check_account_admin($arr) {
if(is_site_admin())
return true;
- $admin_email = trim(get_config('system','admin_email'));
+ $admin_email = trim(Config::Get('system','admin_email'));
if(strlen($admin_email) && $admin_email === trim($arr['email']))
return true;
return false;
@@ -182,7 +183,7 @@ function create_account_IS_OBSOLETE($arr) {
$roles = ((x($arr,'account_roles')) ? intval($arr['account_roles']) : 0 );
$expires = ((x($arr,'expires')) ? intval($arr['expires']) : NULL_DATE);
- $default_service_class = get_config('system','default_service_class');
+ $default_service_class = Config::Get('system','default_service_class');
if($default_service_class === false)
$default_service_class = '';
@@ -209,10 +210,10 @@ function create_account_IS_OBSOLETE($arr) {
// Ensure that there is a host keypair.
- if ((! get_config('system', 'pubkey')) && (! get_config('system', 'prvkey'))) {
+ if ((! Config::Get('system', 'pubkey')) && (! Config::Get('system', 'prvkey'))) {
$hostkey = Crypto::new_keypair(4096);
- set_config('system', 'pubkey', $hostkey['pubkey']);
- set_config('system', 'prvkey', $hostkey['prvkey']);
+ Config::Set('system', 'pubkey', $hostkey['pubkey']);
+ Config::Set('system', 'prvkey', $hostkey['prvkey']);
}
$invite_result = check_account_invite($invite_code);
@@ -319,7 +320,7 @@ function create_account_from_register($arr) {
// account
$expires = NULL_DATE;
- $default_service_class = get_config('system','default_service_class');
+ $default_service_class = Config::Get('system','default_service_class');
if($default_service_class === false)
$default_service_class = '';
@@ -420,7 +421,7 @@ function verify_email_address($arr) {
$email_msg = replace_macros(get_intltext_template('register_verify_member.tpl'),
[
- '$sitename' => get_config('system','sitename'),
+ '$sitename' => Config::Get('system','sitename'),
'$siteurl' => z_root(),
'$email' => $arr['email'],
'$uid' => 1,
@@ -432,7 +433,7 @@ function verify_email_address($arr) {
$res = z_mail(
[
'toEmail' => $arr['email'],
- 'messageSubject' => sprintf( t('Registration confirmation for %s'), get_config('system','sitename')),
+ 'messageSubject' => sprintf( t('Registration confirmation for %s'), Config::Get('system','sitename')),
'textVersion' => $email_msg,
]
);
@@ -488,7 +489,7 @@ function verify_email_addressNOP($arr) {
$email_msg = replace_macros(get_intltext_template('register_verify_member.tpl'),
[
- '$sitename' => get_config('system','sitename'),
+ '$sitename' => Config::Get('system','sitename'),
'$siteurl' => z_root(),
'$email' => $arr['email'],
'$uid' => $account['account_id'],
@@ -500,7 +501,7 @@ function verify_email_addressNOP($arr) {
$res = z_mail(
[
'toEmail' => $arr['email'],
- 'messageSubject' => sprintf( t('Registration confirmation for %s'), get_config('system','sitename')),
+ 'messageSubject' => sprintf( t('Registration confirmation for %s'), Config::Get('system','sitename')),
'textVersion' => $email_msg,
]
);
@@ -564,7 +565,7 @@ function send_reg_approval_email($arr) {
push_lang('en');
$email_msg = replace_macros(get_intltext_template('register_verify_eml.tpl'), array(
- '$sitename' => get_config('system','sitename'),
+ '$sitename' => Config::Get('system','sitename'),
'$siteurl' => z_root(),
'$email' => $arr['email'],
'$uid' => $arr['account']['account_id'],
@@ -575,7 +576,7 @@ function send_reg_approval_email($arr) {
$res = z_mail(
[
'toEmail' => $admin['email'],
- 'messageSubject' => sprintf( t('Registration request at %s'), get_config('system','sitename')),
+ 'messageSubject' => sprintf( t('Registration request at %s'), Config::Get('system','sitename')),
'textVersion' => $email_msg,
]
);
@@ -594,7 +595,7 @@ function send_reg_approval_email($arr) {
function send_register_success_email($email,$password) {
$email_msg = replace_macros(get_intltext_template('register_open_eml.tpl'), array(
- '$sitename' => get_config('system','sitename'),
+ '$sitename' => Config::Get('system','sitename'),
'$siteurl' => z_root(),
'$email' => $email,
'$password' => t('your registration password'),
@@ -603,7 +604,7 @@ function send_register_success_email($email,$password) {
$res = z_mail(
[
'toEmail' => $email,
- 'messageSubject' => sprintf( t('Registration details for %s'), get_config('system','sitename')),
+ 'messageSubject' => sprintf( t('Registration details for %s'), Config::Get('system','sitename')),
'textVersion' => $email_msg,
]
);
@@ -681,7 +682,7 @@ function account_allow($hash) {
$email_tpl = get_intltext_template("register_open_eml.tpl");
$email_msg = replace_macros($email_tpl, array(
- '$sitename' => get_config('system','sitename'),
+ '$sitename' => Config::Get('system','sitename'),
'$siteurl' => z_root(),
'$username' => $account[0]['account_email'],
'$email' => $account[0]['account_email'],
@@ -692,14 +693,14 @@ function account_allow($hash) {
$res = z_mail(
[
'toEmail' => $account[0]['account_email'],
- 'messageSubject' => sprintf( t('Registration details for %s'), get_config('system','sitename')),
+ 'messageSubject' => sprintf( t('Registration details for %s'), Config::Get('system','sitename')),
'textVersion' => $email_msg,
]
);
pop_lang();
- if(get_config('system', 'auto_channel_create', 1))
+ if(Config::Get('system', 'auto_channel_create', 1))
auto_channel_create($register[0]['uid']);
if ($res) {
@@ -844,7 +845,7 @@ function account_approve($hash) {
if(! $account)
return $ret;
- if(get_config('system','auto_channel_create'))
+ if(Config::Get('system','auto_channel_create'))
auto_channel_create($register[0]['reg_uid']);
else {
$_SESSION['login_return_url'] = 'new_channel';
@@ -992,7 +993,7 @@ function downgrade_accounts() {
if(! $r)
return;
- $basic = get_config('system','default_service_class');
+ $basic = Config::Get('system','default_service_class');
foreach($r as $rr) {
if(($basic) && ($rr['account_service_class']) && ($rr['account_service_class'] != $basic)) {
@@ -1135,7 +1136,7 @@ function service_class_fetch($uid, $property) {
if(! x($service_class))
return false; // everything is allowed
- $arr = get_config('service_class', $service_class);
+ $arr = Config::Get('service_class', $service_class);
if(! is_array($arr) || (! count($arr)))
return false;
@@ -1169,7 +1170,7 @@ function account_service_class_fetch($aid, $property) {
if(! isset($service_class))
return false; // everything is allowed
- $arr = get_config('service_class', $service_class);
+ $arr = Config::Get('service_class', $service_class);
if(! is_array($arr) || (! count($arr)))
return false;
@@ -1179,7 +1180,7 @@ function account_service_class_fetch($aid, $property) {
function upgrade_link($bbcode = false) {
- $l = get_config('service_class', 'upgrade_link');
+ $l = Config::Get('service_class', 'upgrade_link');
if(! $l)
return '';
if($bbcode)
@@ -1208,7 +1209,7 @@ function get_account_techlevel($account_id = 0) {
function zar_log($msg='') {
- if(get_config('system', 'register_logfile', 0)) {
+ if(Config::Get('system', 'register_logfile', 0)) {
file_put_contents('./zar.log',
date('Y-m-d_H:i:s') . ' ' . $msg . ', ip: § ' . $_SERVER['REMOTE_ADDR'] . ' §' . "\n", FILE_APPEND);
}
diff --git a/include/attach.php b/include/attach.php
index e5a2900b3..efefc73a4 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -11,11 +11,12 @@
* @todo Also an 'append' option to the storage function might be a useful addition.
*/
-use Zotlabs\Lib\Libsync;
-use Zotlabs\Lib\Activity;
use Zotlabs\Access\PermissionLimits;
use Zotlabs\Daemon\Master;
use Zotlabs\Lib\AccessList;
+use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\Config;
+use Zotlabs\Lib\Libsync;
require_once('include/permissions.php');
require_once('include/security.php');
@@ -801,7 +802,7 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) {
// Check storage limits
if($options !== 'update') {
- $maxfilesize = get_config('system','maxfilesize');
+ $maxfilesize = Config::Get('system','maxfilesize');
if(($maxfilesize) && ($filesize > $maxfilesize)) {
logger('quota_exceeded');
diff --git a/include/auth.php b/include/auth.php
index 5956b89e2..0cd48bce3 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -9,8 +9,9 @@
* Also provides a function for OpenID identiy matching.
*/
-use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\AConfig;
+use Zotlabs\Lib\Config;
+use Zotlabs\Lib\Libzot;
use Zotlabs\Module\Totp_check;
require_once('include/api_auth.php');
@@ -43,8 +44,8 @@ function account_verify_password($login, $pass) {
$ret = [ 'account' => null, 'channel' => null, 'xchan' => null ];
$login = punify($login);
- $email_verify = get_config('system', 'verify_email');
- $register_policy = get_config('system', 'register_policy');
+ $email_verify = Config::Get('system', 'verify_email');
+ $register_policy = Config::Get('system', 'register_policy');
if(!$login || !$pass)
return null;
@@ -170,7 +171,7 @@ function account_verify_password($login, $pass) {
* Error message to display for failed login.
*/
function log_failed_login($errormsg) {
- $authlog = get_config('system', 'authlog');
+ $authlog = Config::Get('system', 'authlog');
if ($authlog)
@file_put_contents($authlog, datetime_convert() . ':' . session_id() . ' ' . $errormsg . PHP_EOL, FILE_APPEND);
}
@@ -208,10 +209,10 @@ if((isset($_SESSION)) && (x($_SESSION, 'authenticated')) &&
if(x($_SESSION, 'visitor_id') && (! x($_SESSION, 'uid'))) {
// if our authenticated guest is allowed to take control of the admin channel, make it so.
- $admins = get_config('system', 'remote_admin');
+ $admins = Config::Get('system', 'remote_admin');
if($admins && is_array($admins) && in_array($_SESSION['visitor_id'], $admins)) {
$x = q("select * from account where account_email = '%s' and account_email != '' and ( account_flags & %d )>0 limit 1",
- dbesc(get_config('system', 'admin_email')),
+ dbesc(Config::Get('system', 'admin_email')),
intval(ACCOUNT_ROLE_ADMIN)
);
if($x) {
@@ -328,7 +329,7 @@ else {
$error = 'authenticate: failed login attempt: ' . notags(trim($username)) . ' from IP ' . $_SERVER['REMOTE_ADDR'];
logger($error);
// Also log failed logins to a separate auth log to reduce overhead for server side intrusion prevention
- $authlog = get_config('system', 'authlog');
+ $authlog = Config::Get('system', 'authlog');
if ($authlog)
@file_put_contents($authlog, datetime_convert() . ':' . session_id() . ' ' . $error . "\n", FILE_APPEND);
notice( t('Login failed.') . EOL );
diff --git a/include/bbcode.php b/include/bbcode.php
index 79cb82c0b..aa1257a56 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -4,8 +4,9 @@
* @brief BBCode related functions for parsing, etc.
*/
-use Zotlabs\Lib\SvgSanitizer;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
+use Zotlabs\Lib\SvgSanitizer;
require_once('include/oembed.php');
require_once('include/event.php');
@@ -111,7 +112,7 @@ function tryzrlvideo($match) {
if($zrl)
$link = zid($link);
- $static_link = get_config('system','video_default_poster','images/video_poster.jpg');
+ $static_link = Config::Get('system','video_default_poster','images/video_poster.jpg');
if($static_link)
$poster = 'poster="' . escape_tags($static_link) . '" ' ;
@@ -1142,7 +1143,7 @@ function parseIdentityAwareHTML($Text) {
$Text = str_replace('[observer.photo]','', $Text);
}
- $Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text);
+ $Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),Config::Get('system','sitename')),$Text);
// Unhide all [noparse] contained bbtags unspacefying them
@@ -1249,7 +1250,7 @@ function bbcode($text, $options = []) {
$text = $x['body'];
$saved_images = $x['images'];
- $text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$text);
+ $text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),Config::Get('system','sitename')),$text);
// Replace any html brackets with HTML Entities to prevent executing HTML or script
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
diff --git a/include/channel.php b/include/channel.php
index a82794bfd..568ad052a 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -9,6 +9,7 @@ use Zotlabs\Access\PermissionRoles;
use Zotlabs\Access\PermissionLimits;
use Zotlabs\Access\Permissions;
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Crypto;
use Zotlabs\Lib\System;
use Zotlabs\Render\Comanche;
@@ -108,11 +109,11 @@ function create_sys_channel() {
// Ensure that there is a host keypair.
- if ((! get_config('system', 'pubkey')) && (! get_config('system', 'prvkey'))) {
+ if ((! Config::Get('system', 'pubkey')) && (! Config::Get('system', 'prvkey'))) {
require_once('include/crypto.php');
$hostkey = Crypto::new_keypair(4096);
- set_config('system', 'pubkey', $hostkey['pubkey']);
- set_config('system', 'prvkey', $hostkey['prvkey']);
+ Config::Set('system', 'pubkey', $hostkey['pubkey']);
+ Config::Set('system', 'prvkey', $hostkey['prvkey']);
}
create_identity([
@@ -357,10 +358,10 @@ function create_identity($arr) {
'hubloc_primary' => intval($primary),
'hubloc_url' => z_root(),
'hubloc_url_sig' => Libzot::sign(z_root(),$ret['channel']['channel_prvkey']),
- 'hubloc_site_id' => Libzot::make_xchan_hash(z_root(),get_config('system','pubkey')),
+ 'hubloc_site_id' => Libzot::make_xchan_hash(z_root(),Config::Get('system','pubkey')),
'hubloc_host' => App::get_hostname(),
'hubloc_callback' => z_root() . '/zot',
- 'hubloc_sitekey' => get_config('system','pubkey'),
+ 'hubloc_sitekey' => Config::Get('system','pubkey'),
'hubloc_network' => 'zot6',
'hubloc_updated' => datetime_convert()
]
@@ -493,7 +494,7 @@ function create_identity($arr) {
// otherwise it could get annoying. Don't make this list too big
// or it will impact registration time.
- $accts = get_config('system','auto_follow');
+ $accts = Config::Get('system','auto_follow');
if(($accts) && (! $total_identities)) {
if(! is_array($accts))
$accts = array($accts);
@@ -1591,7 +1592,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true, $details =
$reddress = true;
$connect_url = '';
$connect = '';
- $default_cover = get_config('system', 'default_cover_photo', 'hubzilla');
+ $default_cover = Config::Get('system', 'default_cover_photo', 'hubzilla');
$default_cover_url = z_root() . '/images/default_cover_photos/' . $default_cover . '/425.png';
@@ -2040,7 +2041,7 @@ function get_theme_uid() {
* @return string with path to profile photo
*/
function get_default_profile_photo($size = 300) {
- $scheme = get_config('system','default_profile_photo');
+ $scheme = Config::Get('system','default_profile_photo');
if(! $scheme)
$scheme = 'rainbow_man';
@@ -2171,7 +2172,7 @@ function is_public_profile() {
if(! local_channel())
return false;
- if(intval(get_config('system','block_public')))
+ if(intval(Config::Get('system','block_public')))
return false;
$channel = App::get_channel();
@@ -2186,7 +2187,7 @@ function is_public_profile() {
function get_profile_fields_basic($filter = 0) {
- $profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null);
+ $profile_fields_basic = (($filter == 0) ? Config::Get('system','profile_fields_basic') : null);
if(! $profile_fields_basic)
$profile_fields_basic = array('fullname','pdesc','chandesc','comms','gender','dob','dob_tz','region','country_name','marital','sexual','homepage','hometown','keywords','about','contact');
@@ -2202,7 +2203,7 @@ function get_profile_fields_basic($filter = 0) {
function get_profile_fields_advanced($filter = 0) {
$basic = get_profile_fields_basic($filter);
- $profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null);
+ $profile_fields_advanced = (($filter == 0) ? Config::Get('system','profile_fields_advanced') : null);
if(! $profile_fields_advanced)
$profile_fields_advanced = array('address','locality','postal_code','partner','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','employment','education');
@@ -2423,7 +2424,7 @@ function get_zcard($channel, $observer_hash = '', $args = array()) {
$cover = $r[0];
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
} else {
- $default_cover = get_config('system', 'default_cover_photo', 'hubzilla');
+ $default_cover = Config::Get('system', 'default_cover_photo', 'hubzilla');
$cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.png' ];
}
@@ -2500,7 +2501,7 @@ function get_zcard_embed($channel, $observer_hash = '', $args = array()) {
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
}
else {
- $default_cover = get_config('system', 'default_cover_photo', 'hubzilla');
+ $default_cover = Config::Get('system', 'default_cover_photo', 'hubzilla');
$cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.png' ];
}
diff --git a/include/cli_startup.php b/include/cli_startup.php
index b9e7d124d..012b29fbf 100644
--- a/include/cli_startup.php
+++ b/include/cli_startup.php
@@ -2,11 +2,13 @@
require_once('boot.php');
+use Zotlabs\Lib\Config;
+
// Everything we need to boot standalone 'background' processes
function cli_startup() {
sys_boot();
- App::set_baseurl(get_config('system','baseurl'));
+ App::set_baseurl(Config::Get('system','baseurl'));
}
diff --git a/include/config.php b/include/config.php
index ec3547a82..674d5afe4 100644
--- a/include/config.php
+++ b/include/config.php
@@ -31,18 +31,83 @@
use Zotlabs\Lib as Zlib;
+/**
+ * Loads the hub's configuration from database to a cached storage.
+ *
+ * Retrieve a category ($family) of config variables from database to a cached
+ * storage in the global App::$config[$family].
+ *
+ * @param string $family The category of the configuration value
+ *
+ * @return Nothing
+ *
+ * @deprecated
+ * This function is deprecated, use Zotlabs\Lib\Config::Load
+ * instead.
+ */
function load_config($family) {
Zlib\Config::Load($family);
}
+/**
+ * Get a particular config variable given the category name ($family)
+ * and a key.
+ *
+ * Get a particular config variable from the given category ($family) and the
+ * $key from a cached storage in App::$config[$family]. If a key is found in the
+ * DB but does not exist in local config cache, pull it into the cache so we
+ * do not have to hit the DB again for this item.
+ *
+ * Returns false if not set.
+ *
+ * @param string $family The category of the configuration value
+ * @param string $key The configuration key to query
+ * @param string $default (optional) default false
+ *
+ * @return mixed|false Return value or false on error or if not set
+ *
+ * @deprecated
+ * This function is deprecated, use Zotlabs\Lib\Config::Get
+ * instead.
+ */
function get_config($family, $key, $default = false) {
return Zlib\Config::Get($family,$key,$default);
}
+/**
+ * Sets a configuration value for the hub.
+ *
+ * Stores a config value ($value) in the category ($family) under the key ($key).
+ *
+ * @param string $family The category of the configuration value
+ * @param string $key The configuration key to set
+ * @param mixed $value The value to store in the configuration
+ *
+ * @return mixed|false Return the set value, or false if the database update failed
+ *
+ * @deprecated
+ * This function is deprecated, use Zotlabs\Lib\Config::Set
+ * instead.
+ */
function set_config($family, $key, $value) {
return Zlib\Config::Set($family,$key,$value);
}
+/**
+ * Deletes the given key from the hub's configuration database.
+ *
+ * Removes the configured value from the stored cache in App::$config[$family]
+ * and removes it from the database.
+ *
+ * @param string $family The category of the configuration value
+ * @param string $key The configuration key to delete
+ *
+ * @return mixed
+ *
+ * @deprecated
+ * This function is deprecated, use Zotlabs\Lib\Config::Delete
+ * instead.
+ */
function del_config($family, $key) {
return Zlib\Config::Delete($family,$key);
}
diff --git a/include/connections.php b/include/connections.php
index 9a6ee7d8d..e5cc90411 100644
--- a/include/connections.php
+++ b/include/connections.php
@@ -1,6 +1,7 @@
<?php /** @file */
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
function abook_store_lowlevel($arr) {
@@ -238,7 +239,7 @@ function abook_toggle_flag($abook,$flag) {
function mark_orphan_hubsxchans() {
- $dirmode = intval(get_config('system','directory_mode'));
+ $dirmode = intval(Config::Get('system','directory_mode'));
if($dirmode == DIRECTORY_MODE_NORMAL)
return;
@@ -511,8 +512,8 @@ function remove_abook_items($channel_id, $xchan_hash) {
function random_profile() {
$randfunc = db_getfunc('rand');
- $checkrandom = get_config('randprofile','check'); // False by default
- $retryrandom = intval(get_config('randprofile','retry'));
+ $checkrandom = Config::Get('randprofile','check'); // False by default
+ $retryrandom = intval(Config::Get('randprofile','retry'));
if($retryrandom == 0) $retryrandom = 5;
for($i = 0; $i < $retryrandom; $i++) {
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index c05ecaf7c..43aae4b25 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -1,10 +1,11 @@
<?php /** @file */
use Zotlabs\Lib\Cache;
+use Zotlabs\Lib\Config;
function findpeople_widget() {
- if(get_config('system','invitation_only')) {
+ if(Config::Get('system','invitation_only')) {
$x = get_pconfig(local_channel(),'system','invites_remaining');
if($x || is_site_admin()) {
App::$page['aside'] .= '<div class="side-link" id="side-invite-remain">'
diff --git a/include/conversation.php b/include/conversation.php
index 79fe12d54..3992f06f6 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1,7 +1,8 @@
<?php /** @file */
-use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
require_once('include/items.php');
@@ -1336,7 +1337,7 @@ function get_item_children($arr, $parent) {
$children = array();
foreach($arr as $item) {
if($item['id'] != $item['parent']) {
- if(get_config('system','thread_allow')) {
+ if(Config::Get('system','thread_allow')) {
// Fallback to parent_mid if thr_parent is not set
$thr_parent = $item['thr_parent'];
if($thr_parent == '')
diff --git a/include/crypto.php b/include/crypto.php
index 40e68a4e7..4d50310fb 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -1,5 +1,7 @@
<?php /** @file */
+use Zotlabs\Lib\Config;
+
require_once('library/ASNValue.class.php');
require_once('library/asn1.php');
@@ -282,7 +284,7 @@ function new_keypair($bits) {
'encrypt_key' => false
);
- $conf = get_config('system','openssl_conf_file');
+ $conf = Config::Get('system','openssl_conf_file');
if($conf)
$openssl_options['config'] = $conf;
@@ -460,12 +462,12 @@ function convert_salmon_key($key) {
function z_obscure($s) {
- return json_encode(crypto_encapsulate($s,get_config('system','pubkey')));
+ return json_encode(crypto_encapsulate($s,Config::Get('system','pubkey')));
}
function z_unobscure($s) {
if(strpos($s,"{\"") !== 0)
return $s;
- return crypto_unencapsulate(json_decode($s,true),get_config('system','prvkey'));
+ return crypto_unencapsulate(json_decode($s,true),Config::Get('system','prvkey'));
}
diff --git a/include/event.php b/include/event.php
index 701f3c330..ef73fc9b5 100644
--- a/include/event.php
+++ b/include/event.php
@@ -8,6 +8,7 @@
use Sabre\VObject;
use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
use Zotlabs\Access\AccessList;
@@ -237,7 +238,7 @@ function ical_wrapper($ev) {
$o .= "BEGIN:VCALENDAR";
$o .= "\r\nVERSION:2.0";
$o .= "\r\nMETHOD:PUBLISH";
- $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . Zotlabs\Lib\System::get_platform_name() . "//" . strtoupper(App::$language). "\r\n";
+ $o .= "\r\nPRODID:-//" . Config::Get('system','sitename') . "//" . Zotlabs\Lib\System::get_platform_name() . "//" . strtoupper(App::$language). "\r\n";
if(array_key_exists('dtstart', $ev))
$o .= format_event_ical($ev);
else {
diff --git a/include/features.php b/include/features.php
index e57859aa8..d527f60e6 100644
--- a/include/features.php
+++ b/include/features.php
@@ -4,17 +4,15 @@
* Features management
*/
-
-
-
+use Zotlabs\Lib\Config;
function feature_enabled($uid,$feature) {
- $x = get_config('feature_lock',$feature);
+ $x = Config::Get('feature_lock',$feature);
if($x === false) {
$x = get_pconfig($uid,'feature',$feature);
if($x === false) {
- $x = get_config('feature',$feature);
+ $x = Config::Get('feature',$feature);
if($x === false)
$x = get_feature_default($feature);
}
@@ -38,7 +36,7 @@ function get_feature_default($feature) {
function feature_level($feature,$def) {
- $x = get_config('feature_level',$feature);
+ $x = Config::Get('feature_level',$feature);
if($x !== false)
return intval($x);
return $def;
@@ -86,7 +84,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Start calendar week on Monday'),
t('Default is Sunday'),
false,
- get_config('feature_lock','cal_first_day')
+ Config::Get('feature_lock','cal_first_day')
],
[
@@ -94,7 +92,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Event Timezone Selection'),
t('Allow event creation in timezones other than your own.'),
false,
- get_config('feature_lock','event_tz_select'),
+ Config::Get('feature_lock','event_tz_select'),
]
],
@@ -108,7 +106,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Search by Date'),
t('Ability to select posts by date ranges'),
false,
- get_config('feature_lock','archives')
+ Config::Get('feature_lock','archives')
],
[
@@ -116,7 +114,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Tag Cloud'),
t('Provide a personal tag cloud on your channel page'),
false,
- get_config('feature_lock','tagadelic'),
+ Config::Get('feature_lock','tagadelic'),
],
[
@@ -124,7 +122,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Use blog/list mode'),
t('Comments will be displayed separately'),
false,
- get_config('feature_lock','channel_list_mode'),
+ Config::Get('feature_lock','channel_list_mode'),
]
],
@@ -137,7 +135,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Connection Filtering'),
t('Filter incoming posts from connections based on keywords/content'),
false,
- get_config('feature_lock','connfilter')
+ Config::Get('feature_lock','connfilter')
]
],
@@ -150,7 +148,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Community Tagging'),
t('Ability to tag existing posts'),
false,
- get_config('feature_lock','commtag'),
+ Config::Get('feature_lock','commtag'),
],
*/
[
@@ -158,7 +156,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Emoji Reactions'),
t('Add emoji reaction ability to posts'),
true,
- get_config('feature_lock','emojis'),
+ Config::Get('feature_lock','emojis'),
],
[
@@ -166,7 +164,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Dislike Posts'),
t('Ability to dislike posts/comments'),
false,
- get_config('feature_lock','dislike'),
+ Config::Get('feature_lock','dislike'),
],
[
@@ -174,7 +172,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Star Posts'),
t('Ability to mark special posts with a star indicator'),
false,
- get_config('feature_lock','star_posts'),
+ Config::Get('feature_lock','star_posts'),
],
[
@@ -182,7 +180,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Reply on comment'),
t('Ability to reply on selected comment'),
false,
- get_config('feature_lock','reply_to'),
+ Config::Get('feature_lock','reply_to'),
]
],
@@ -196,7 +194,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Advanced Directory Search'),
t('Allows creation of complex directory search queries'),
false,
- get_config('feature_lock','advanced_dirsearch'),
+ Config::Get('feature_lock','advanced_dirsearch'),
]
],
@@ -210,7 +208,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Post Categories'),
t('Add categories to your posts'),
false,
- get_config('feature_lock','categories'),
+ Config::Get('feature_lock','categories'),
],
[
@@ -218,7 +216,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Large Photos'),
t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'),
false,
- get_config('feature_lock','large_photos'),
+ Config::Get('feature_lock','large_photos'),
],
[
@@ -226,7 +224,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Even More Encryption'),
t('Allow optional encryption of content end-to-end with a shared secret key'),
false,
- get_config('feature_lock','content_encrypt'),
+ Config::Get('feature_lock','content_encrypt'),
],
[
@@ -234,7 +232,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Disable Comments'),
t('Provide the option to disable comments for a post'),
false,
- get_config('feature_lock','disable_comments'),
+ Config::Get('feature_lock','disable_comments'),
],
[
@@ -242,7 +240,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Delayed Posting'),
t('Allow posts to be published at a later date'),
false,
- get_config('feature_lock','delayed_posting'),
+ Config::Get('feature_lock','delayed_posting'),
],
[
@@ -250,7 +248,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Content Expiration'),
t('Remove posts/comments and/or private messages at a future time'),
false,
- get_config('feature_lock','content_expire'),
+ Config::Get('feature_lock','content_expire'),
],
[
@@ -258,7 +256,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Suppress Duplicate Posts/Comments'),
t('Prevent posts with identical content to be published with less than two minutes in between submissions.'),
true,
- get_config('feature_lock','suppress_duplicates'),
+ Config::Get('feature_lock','suppress_duplicates'),
],
[
@@ -266,7 +264,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Auto-save drafts of posts and comments'),
t('Automatically saves post and comment drafts in local browser storage to help prevent accidental loss of compositions'),
true,
- get_config('feature_lock','auto_save_draft'),
+ Config::Get('feature_lock','auto_save_draft'),
]
],
@@ -280,7 +278,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Navigation Channel Select'),
t('Change channels directly from within the navigation dropdown menu'),
false,
- get_config('feature_lock','nav_channel_select'),
+ Config::Get('feature_lock','nav_channel_select'),
]
],
@@ -294,7 +292,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Events Filter'),
t('Ability to display only events'),
false,
- get_config('feature_lock','events_tab')
+ Config::Get('feature_lock','events_tab')
],
[
@@ -302,7 +300,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Polls Filter'),
t('Ability to display only polls'),
false,
- get_config('feature_lock','polls_tab')
+ Config::Get('feature_lock','polls_tab')
],
[
@@ -310,7 +308,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Saved Searches'),
t('Save search terms for re-use'),
false,
- get_config('feature_lock','savedsearch')
+ Config::Get('feature_lock','savedsearch')
],
[
@@ -318,7 +316,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Saved Folders'),
t('Ability to file posts under folders'),
false,
- get_config('feature_lock','filing'),
+ Config::Get('feature_lock','filing'),
],
[
@@ -326,7 +324,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Alternate Stream Order'),
t('Ability to order the stream by last post date, last comment date or unthreaded activities'),
false,
- get_config('feature_lock','order_tab')
+ Config::Get('feature_lock','order_tab')
],
[
@@ -334,7 +332,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Contact Filter'),
t('Ability to display only posts of a selected contact'),
false,
- get_config('feature_lock','name_tab')
+ Config::Get('feature_lock','name_tab')
],
[
@@ -342,7 +340,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Forum Filter'),
t('Ability to display only posts of a specific forum'),
false,
- get_config('feature_lock','forums_tab')
+ Config::Get('feature_lock','forums_tab')
],
[
@@ -350,7 +348,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Personal Posts Filter'),
t('Ability to display only posts that you\'ve interacted on'),
false,
- get_config('feature_lock','personal_tab')
+ Config::Get('feature_lock','personal_tab')
],
[
@@ -358,7 +356,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Use blog/list mode'),
t('Comments will be displayed separately'),
false,
- get_config('feature_lock','network_list_mode'),
+ Config::Get('feature_lock','network_list_mode'),
]
],
@@ -372,7 +370,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Photo Location'),
t('If location data is available on uploaded photos, link this to a map.'),
false,
- get_config('feature_lock','photo_location'),
+ Config::Get('feature_lock','photo_location'),
],
[
@@ -380,7 +378,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Flag Adult Photos'),
t('Provide photo edit option to hide inappropriate photos from default album view'),
false,
- get_config('feature_lock','adult_photo_flagging'),
+ Config::Get('feature_lock','adult_photo_flagging'),
]
],
@@ -394,7 +392,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Advanced Profiles'),
t('Additional profile sections and selections'),
false,
- get_config('feature_lock','advanced_profiles')
+ Config::Get('feature_lock','advanced_profiles')
],
[
@@ -402,7 +400,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Profile Import/Export'),
t('Save and load profile details across sites/channels'),
false,
- get_config('feature_lock','profile_export')
+ Config::Get('feature_lock','profile_export')
],
[
@@ -410,7 +408,7 @@ function get_features($filtered = true, $level = (-1)) {
t('Multiple Profiles'),
t('Ability to create multiple profiles'),
false,
- get_config('feature_lock','multi_profiles')
+ Config::Get('feature_lock','multi_profiles')
]
]
diff --git a/include/feedutils.php b/include/feedutils.php
index f05c15414..a50214746 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -4,6 +4,8 @@
* @brief Some functions to work with XML feeds.
*/
+use Zotlabs\Lib\Config;
+
/**
* @brief Return an Atom feed for channel.
*
@@ -1037,7 +1039,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
- $sys_expire = intval(get_config('system', 'default_expire_days'));
+ $sys_expire = intval(Config::Get('system', 'default_expire_days'));
$chn_expire = intval($importer['channel_expire_days']);
$expire_days = $sys_expire;
@@ -1325,7 +1327,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
// but save the thread_parent in case we need to refer to it later.
if($importer['channel_system']) {
- if( ! \Zotlabs\Lib\MessageFilter::evaluate($datarray,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) {
+ if( ! \Zotlabs\Lib\MessageFilter::evaluate($datarray,Config::Get('system','pubstream_incl'),Config::Get('system','pubstream_excl'))) {
continue;
}
}
@@ -1481,7 +1483,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
}
if($importer['channel_system']) {
- if( ! \Zotlabs\Lib\MessageFilter::evaluate($datarray,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) {
+ if( ! \Zotlabs\Lib\MessageFilter::evaluate($datarray,Config::Get('system','pubstream_incl'),Config::Get('system','pubstream_excl'))) {
continue;
}
}
diff --git a/include/hubloc.php b/include/hubloc.php
index 4d2980a6b..982455f9c 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -5,6 +5,7 @@
*/
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
/**
* @brief Create an array for hubloc table and insert record.
@@ -129,7 +130,7 @@ function remove_obsolete_hublocs() {
$r = q("select hubloc_id from hubloc where hubloc_url = '%s' and hubloc_sitekey = '%s'",
dbesc(z_root()),
- dbesc(get_config('system', 'pubkey'))
+ dbesc(Config::Get('system', 'pubkey'))
);
if((! $r) || (! count($r)))
return;
@@ -139,11 +140,11 @@ function remove_obsolete_hublocs() {
// Do we have any invalid ones?
$r = q("select hubloc_id, hubloc_hash from hubloc where hubloc_sitekey = '%s' and hubloc_url != '%s'",
- dbesc(get_config('system', 'pubkey')),
+ dbesc(Config::Get('system', 'pubkey')),
dbesc(z_root())
);
$p = q("select hubloc_id, hubloc_hash from hubloc where hubloc_sitekey != '%s' and hubloc_url = '%s'",
- dbesc(get_config('system', 'pubkey')),
+ dbesc(Config::Get('system', 'pubkey')),
dbesc(z_root())
);
if(is_array($r) && is_array($p))
@@ -156,7 +157,7 @@ function remove_obsolete_hublocs() {
logger('remove_obsolete_hublocs: removing ' . count($r) . ' hublocs.');
- $interval = get_config('queueworker', 'queue_interval', 500000);
+ $interval = Config::Get('queueworker', 'queue_interval', 500000);
foreach($r as $rr) {
q("update hubloc set hubloc_deleted = 1 where hubloc_id = %d",
diff --git a/include/import.php b/include/import.php
index 7dac518f5..479c2c255 100644
--- a/include/import.php
+++ b/include/import.php
@@ -1,6 +1,7 @@
<?php
use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\IConfig;
use Zotlabs\Lib\Libzot;
@@ -1479,7 +1480,7 @@ function sync_files($channel, $files) {
fclose($fp);
// Override remote hub thumbnails storage settings
- if(! boolval(get_config('system','photo_storage_type', 1))) {
+ if(! boolval(Config::Get('system','photo_storage_type', 1))) {
$p['os_storage'] = 0;
$p['content'] = file_get_contents($stored_image);
@unlink($stored_image);
diff --git a/include/items.php b/include/items.php
index a5a23650e..efc45db38 100644
--- a/include/items.php
+++ b/include/items.php
@@ -4,6 +4,7 @@
* @brief Items related functions.
*/
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Crypto;
use Zotlabs\Lib\Enotify;
use Zotlabs\Lib\MarkdownSoap;
@@ -1078,7 +1079,7 @@ function encode_item($item,$mirror = false,$zap_compat = false) {
$x['type'] = 'activity';
$x['encoding'] = 'zot';
- $key = get_config('system','prvkey');
+ $key = Config::Get('system','prvkey');
// If we're trying to backup an item so that it's recoverable or for export/imprt,
// add all the attributes we need to recover it
@@ -2696,7 +2697,7 @@ function tag_deliver($uid, $item_id) {
logger('Post mentions: ' . print_r($terms,true), LOGGER_DATA);
}
- $max_forums = get_config('system','max_tagged_forums',2);
+ $max_forums = Config::Get('system','max_tagged_forums',2);
$matched_forums = 0;
@@ -2968,7 +2969,7 @@ function tgroup_check($uid, $item) {
if(! $u)
return false;
- $max_forums = get_config('system','max_tagged_forums',2);
+ $max_forums = Config::Get('system','max_tagged_forums',2);
$matched_forums = 0;
$link = normalise_link($u[0]['xchan_url']);
@@ -3073,7 +3074,7 @@ function i_am_mentioned($channel, $item, $check_groups = false) {
}
}
}
- $unless = intval(get_pconfig($channel['channel_id'], 'system', 'unless_mention_count', get_config('system', 'unless_mention_count', 20)));
+ $unless = intval(get_pconfig($channel['channel_id'], 'system', 'unless_mention_count', Config::Get('system', 'unless_mention_count', 20)));
if ($unless && $terms && count($terms) > $unless) {
$tagged = false;
}
@@ -3762,7 +3763,7 @@ function item_expire($uid,$days,$comment_days = 7) {
$sql_extra = ((intval($expire_network_only)) ? " AND item_wall = 0 " : "");
- $expire_limit = get_config('system','expire_limit', 1000);
+ $expire_limit = Config::Get('system','expire_limit', 1000);
$item_normal = item_normal();
diff --git a/include/language.php b/include/language.php
index 1b2e7332e..22f350aac 100644
--- a/include/language.php
+++ b/include/language.php
@@ -10,6 +10,7 @@
use CommerceGuys\Intl\Language\LanguageRepository;
use LanguageDetection\Language;
+use Zotlabs\Lib\Config;
/**
* @brief Get the browser's submitted preferred languages.
@@ -17,7 +18,7 @@ use LanguageDetection\Language;
* This functions parses the HTTP_ACCEPT_LANGUAGE header sent by the browser and
* extracts the preferred languages and their priority.
*
- * Get the language setting directly from system variables, bypassing get_config()
+ * Get the language setting directly from system variables, bypassing Config::Get()
* as database may not yet be configured.
*
* If possible, we use the value from the browser.
@@ -313,8 +314,8 @@ function detect_language($s) {
return EMPTY_STR;
}
- $min_length = get_config('system', 'language_detect_min_length', LANGUAGE_DETECT_MIN_LENGTH);
- $min_confidence = get_config('system', 'language_detect_min_confidence', LANGUAGE_DETECT_MIN_CONFIDENCE);
+ $min_length = Config::Get('system', 'language_detect_min_length', LANGUAGE_DETECT_MIN_LENGTH);
+ $min_confidence = Config::Get('system', 'language_detect_min_confidence', LANGUAGE_DETECT_MIN_CONFIDENCE);
// embedded apps have long base64 strings which will trip up the detector.
$naked_body = preg_replace('/\[app\](.*?)\[\/app\]/', '', $s);
diff --git a/include/nav.php b/include/nav.php
index e4df7e4e5..a68d564a0 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -2,6 +2,7 @@
use \Zotlabs\Lib\Apps;
use \Zotlabs\Lib\Chatroom;
+use \Zotlabs\Lib\Config;
require_once('include/security.php');
require_once('include/menu.php');
@@ -57,10 +58,10 @@ function nav($template = 'default') {
*
*/
- $banner = get_config('system', 'banner');
+ $banner = Config::Get('system', 'banner');
if ($banner === false)
- $banner = get_config('system', 'sitename');
+ $banner = Config::Get('system', 'sitename');
call_hooks('get_banner', $banner);
@@ -175,15 +176,15 @@ function nav($template = 'default') {
];
}
- if ((get_config('system', 'register_policy') == REGISTER_OPEN || get_config('system', 'register_policy') == REGISTER_APPROVE) && empty($_SESSION['authenticated'])) {
+ if ((Config::Get('system', 'register_policy') == REGISTER_OPEN || Config::Get('system', 'register_policy') == REGISTER_APPROVE) && empty($_SESSION['authenticated'])) {
$nav['register'] = ['register', t('Register'), "", t('Create an account'), 'register_nav_btn'];
}
// TODO: update help content for various modules
- if (false /* !get_config('system', 'hide_help') */) {
+ if (false /* !Config::Get('system', 'hide_help') */) {
$help_url = z_root() . '/help?f=&cmd=' . App::$cmd;
$context_help = '';
- $enable_context_help = ((intval(get_config('system', 'enable_context_help')) === 1 || get_config('system', 'enable_context_help') === false) ? true : false);
+ $enable_context_help = ((intval(Config::Get('system', 'enable_context_help')) === 1 || Config::Get('system', 'enable_context_help') === false) ? true : false);
if ($enable_context_help === true) {
require_once('include/help.php');
$context_help = load_context_help();
@@ -350,7 +351,7 @@ function nav($template = 'default') {
'$pleasewait' => t('Please wait...'),
'$nav_apps' => $nav_apps,
'$navbar_apps' => $navbar_apps,
- '$channel_menu' => get_pconfig(App::$profile_uid, 'system', 'channel_menu', get_config('system', 'channel_menu')),
+ '$channel_menu' => get_pconfig(App::$profile_uid, 'system', 'channel_menu', Config::Get('system', 'channel_menu')),
'$channel_thumb' => ((App::$profile) ? App::$profile['thumb'] : ''),
'$channel_apps' => $channel_apps,
'$addapps' => t('Apps'),
diff --git a/include/network.php b/include/network.php
index a5c14f9d1..a7a11ff6e 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1,6 +1,7 @@
<?php
use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Zotfinger;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Queue;
@@ -67,7 +68,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; zot)');
@curl_setopt($ch, CURLOPT_ENCODING, '');
- $ciphers = @get_config('system','curl_ssl_ciphers');
+ $ciphers = @Config::Get('system','curl_ssl_ciphers');
if($ciphers)
@curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers);
@@ -114,7 +115,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_TIMEOUT, intval($opts['timeout']));
}
else {
- $curl_time = intval(@get_config('system','curl_timeout'));
+ $curl_time = intval(@Config::Get('system','curl_timeout'));
@curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
}
@@ -122,7 +123,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, intval($opts['connecttimeout']));
}
else {
- $curl_contime = intval(@get_config('system','curl_connecttimeout'));
+ $curl_contime = intval(@Config::Get('system','curl_connecttimeout'));
@curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (($curl_contime !== false) ? $curl_contime : 30));
}
@@ -145,11 +146,11 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
- $prx = @get_config('system','proxy');
+ $prx = @Config::Get('system','proxy');
if(strlen($prx)) {
@curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
@curl_setopt($ch, CURLOPT_PROXY, $prx);
- $prxusr = @get_config('system','proxyuser');
+ $prxusr = @Config::Get('system','proxyuser');
if(strlen($prxusr))
@curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
}
@@ -263,7 +264,7 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; zot)");
@curl_setopt($ch, CURLOPT_ENCODING, '');
- $ciphers = @get_config('system','curl_ssl_ciphers');
+ $ciphers = @Config::Get('system','curl_ssl_ciphers');
if($ciphers)
@curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers);
@@ -296,7 +297,7 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
}
else {
- $curl_time = intval(@get_config('system','curl_timeout'));
+ $curl_time = intval(@Config::Get('system','curl_timeout'));
@curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
}
@@ -318,11 +319,11 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true));
- $prx = get_config('system','proxy');
+ $prx = Config::Get('system','proxy');
if(strlen($prx)) {
@curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
@curl_setopt($ch, CURLOPT_PROXY, $prx);
- $prxusr = get_config('system','proxyuser');
+ $prxusr = Config::Get('system','proxyuser');
if(strlen($prxusr))
@curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
}
@@ -603,7 +604,7 @@ function validate_url(&$url) {
*/
function validate_email(string $addr): bool {
- if(get_config('system', 'disable_email_validation'))
+ if(Config::Get('system', 'disable_email_validation'))
return true;
$matches = array();
@@ -638,7 +639,7 @@ function allowed_url($url) {
return false;
}
- $str_allowed = get_config('system', 'allowed_sites');
+ $str_allowed = Config::Get('system', 'allowed_sites');
if(! $str_allowed)
return true;
@@ -682,8 +683,8 @@ function allowed_email($email) {
if(! $domain)
return false;
- $str_allowed = get_config('system', 'allowed_email');
- $str_not_allowed = get_config('system', 'not_allowed_email');
+ $str_allowed = Config::Get('system', 'allowed_email');
+ $str_not_allowed = Config::Get('system', 'not_allowed_email');
if(! $str_allowed && ! $str_not_allowed)
return true;
@@ -1472,7 +1473,7 @@ function do_delivery($deliveries, $force = false) {
/*
$x = q("select count(outq_hash) as total from outq where outq_delivered = 0");
- if(intval($x[0]['total']) > intval(get_config('system','force_queue_threshold',3000)) && (! $force)) {
+ if(intval($x[0]['total']) > intval(Config::Get('system','force_queue_threshold',3000)) && (! $force)) {
logger('immediate delivery deferred.', LOGGER_DEBUG, LOG_INFO);
foreach($deliveries as $d) {
Queue::update($d);
@@ -1482,9 +1483,9 @@ function do_delivery($deliveries, $force = false) {
*/
- $interval = get_config('queueworker', 'queue_interval', 500000);
+ $interval = Config::Get('queueworker', 'queue_interval', 500000);
- $deliveries_per_process = intval(get_config('system','delivery_batch_count'));
+ $deliveries_per_process = intval(Config::Get('system','delivery_batch_count'));
if($deliveries_per_process <= 0)
$deliveries_per_process = 1;
@@ -1542,9 +1543,9 @@ function get_site_info() {
$admin = false;
}
- $def_service_class = get_config('system','default_service_class');
+ $def_service_class = Config::Get('system','default_service_class');
if($def_service_class)
- $service_class = get_config('service_class',$def_service_class);
+ $service_class = Config::Get('service_class',$def_service_class);
else
$service_class = false;
@@ -1555,9 +1556,9 @@ function get_site_info() {
if(! isset($commit) || strlen($commit) > 16)
$commit = '';
- $site_info = get_config('system','info');
- $site_name = get_config('system','sitename');
- if(! get_config('system','hidden_version_siteinfo')) {
+ $site_info = Config::Get('system','info');
+ $site_name = Config::Get('system','sitename');
+ if(! Config::Get('system','hidden_version_siteinfo')) {
$version = Zotlabs\Lib\System::get_project_version();
$tag = Zotlabs\Lib\System::get_std_version();
@@ -1573,15 +1574,15 @@ function get_site_info() {
}
//Statistics
- $channels_total_stat = intval(get_config('system','channels_total_stat'));
- $channels_active_halfyear_stat = intval(get_config('system','channels_active_halfyear_stat'));
- $channels_active_monthly_stat = intval(get_config('system','channels_active_monthly_stat'));
- $local_posts_stat = intval(get_config('system','local_posts_stat'));
- $local_comments_stat = intval(get_config('system','local_comments_stat'));
- $hide_in_statistics = intval(get_config('system','hide_in_statistics'));
- $site_expire = intval(get_config('system', 'default_expire_days'));
-
- load_config('feature_lock');
+ $channels_total_stat = intval(Config::Get('system','channels_total_stat'));
+ $channels_active_halfyear_stat = intval(Config::Get('system','channels_active_halfyear_stat'));
+ $channels_active_monthly_stat = intval(Config::Get('system','channels_active_monthly_stat'));
+ $local_posts_stat = intval(Config::Get('system','local_posts_stat'));
+ $local_comments_stat = intval(Config::Get('system','local_comments_stat'));
+ $hide_in_statistics = intval(Config::Get('system','hide_in_statistics'));
+ $site_expire = intval(Config::Get('system', 'default_expire_days'));
+
+ Config::Load('feature_lock');
$locked_features = array();
if(is_array(App::$config['feature_lock']) && count(App::$config['feature_lock'])) {
foreach(App::$config['feature_lock'] as $k => $v) {
@@ -1602,18 +1603,18 @@ function get_site_info() {
'server_role' => Zotlabs\Lib\System::get_server_role(),
'commit' => $commit,
'plugins' => $visible_plugins,
- 'register_policy' => $register_policy[get_config('system','register_policy')],
- 'invitation_only' => (bool) intval(get_config('system','invitation_only')),
- 'directory_mode' => $directory_mode[get_config('system','directory_mode')],
- 'directory_server' => get_config('system','directory_server'),
- 'language' => get_config('system','language'),
- 'rss_connections' => (bool) intval(get_config('system','feed_contacts')),
+ 'register_policy' => $register_policy[Config::Get('system','register_policy')],
+ 'invitation_only' => (bool) intval(Config::Get('system','invitation_only')),
+ 'directory_mode' => $directory_mode[Config::Get('system','directory_mode')],
+ 'directory_server' => Config::Get('system','directory_server'),
+ 'language' => Config::Get('system','language'),
+ 'rss_connections' => (bool) intval(Config::Get('system','feed_contacts')),
'expiration' => $site_expire,
'default_service_restrictions' => $service_class,
'locked_features' => $locked_features,
'admin' => $admin,
'dbdriver' => DBA::$dba->getdriver() . ' ' . ((ACTIVE_DBTYPE == DBTYPE_POSTGRES) ? 'postgres' : 'mysql'),
- 'lastpoll' => get_config('system','lastpoll'),
+ 'lastpoll' => Config::Get('system','lastpoll'),
'info' => (($site_info) ? $site_info : ''),
'channels_total' => $channels_total_stat,
'hide_in_statistics' => $hide_in_statistics
@@ -1651,7 +1652,7 @@ function check_siteallowed($url) {
if(array_key_exists('allowed',$arr))
return $arr['allowed'];
- $bl1 = get_config('system','whitelisted_sites');
+ $bl1 = Config::Get('system','whitelisted_sites');
if(is_array($bl1) && $bl1) {
foreach($bl1 as $bl) {
if($bl1 === '*')
@@ -1660,7 +1661,7 @@ function check_siteallowed($url) {
return true;
}
}
- $bl1 = get_config('system','blacklisted_sites');
+ $bl1 = Config::Get('system','blacklisted_sites');
if(is_array($bl1) && $bl1) {
foreach($bl1 as $bl) {
if($bl1 === '*')
@@ -1696,7 +1697,7 @@ function check_channelallowed($hash) {
if(array_key_exists('allowed',$arr))
return $arr['allowed'];
- $bl1 = get_config('system','whitelisted_channels');
+ $bl1 = Config::Get('system','whitelisted_channels');
if(is_array($bl1) && $bl1) {
foreach($bl1 as $bl) {
if($bl1 === '*')
@@ -1705,7 +1706,7 @@ function check_channelallowed($hash) {
return true;
}
}
- $bl1 = get_config('system','blacklisted_channels');
+ $bl1 = Config::Get('system','blacklisted_channels');
if(is_array($bl1) && $bl1) {
foreach($bl1 as $bl) {
if($bl1 === '*')
@@ -1810,17 +1811,17 @@ function network_to_name($s) {
function z_mail($params) {
if(! $params['fromEmail']) {
- $params['fromEmail'] = get_config('system','from_email');
+ $params['fromEmail'] = Config::Get('system','from_email');
if(! $params['fromEmail'])
$params['fromEmail'] = 'Administrator' . '@' . App::get_hostname();
}
if(! $params['fromName']) {
- $params['fromName'] = get_config('system','from_email_name');
+ $params['fromName'] = Config::Get('system','from_email_name');
if(! $params['fromName'])
$params['fromName'] = Zotlabs\Lib\System::get_site_name();
}
if(! $params['replyTo']) {
- $params['replyTo'] = get_config('system','reply_address');
+ $params['replyTo'] = Config::Get('system','reply_address');
if(! $params['replyTo'])
$params['replyTo'] = 'noreply' . '@' . App::get_hostname();
}
diff --git a/include/oauth.php b/include/oauth.php
index 845ec4558..3426f9ca5 100644
--- a/include/oauth.php
+++ b/include/oauth.php
@@ -1,11 +1,13 @@
<?php /** @file */
-/**
+/**
* OAuth server
* Based on oauth2-php <http://code.google.com/p/oauth2-php/>
- *
+ *
*/
+use Zotlabs\Lib\Config;
+
define('REQUEST_TOKEN_DURATION', 300);
define('ACCESS_TOKEN_DURATION', 31536000);
@@ -18,7 +20,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
function gen_token(){
return md5(base64_encode(pack('N6', mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), uniqid())));
}
-
+
function lookup_consumer($consumer_key) {
logger('consumer_key: ' . $consumer_key, LOGGER_DEBUG);
@@ -72,7 +74,7 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
$key = $this->gen_token();
$sec = $this->gen_token();
-
+
if ($consumer->key){
$k = $consumer->key;
} else {
@@ -94,19 +96,19 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
function new_access_token($token, $consumer, $verifier = null) {
logger(__function__.":".$token.", ". $consumer.", ". $verifier, LOGGER_DEBUG);
-
+
// return a new access token attached to this consumer
// for the user associated with this token if the request token
// is authorized
// should also invalidate the request token
-
+
$ret=Null;
-
+
// get user for this verifier
- $uverifier = get_config("oauth", $verifier);
+ $uverifier = Config::Get("oauth", $verifier);
logger(__function__.":".$verifier.",".$uverifier, LOGGER_DEBUG);
if (is_null($verifier) || ($uverifier!==false)) {
-
+
$key = $this->gen_token();
$sec = $this->gen_token();
@@ -119,16 +121,16 @@ class ZotOAuth1DataStore extends OAuth1DataStore {
intval($uverifier));
if ($r)
- $ret = new OAuth1Token($key,$sec);
+ $ret = new OAuth1Token($key,$sec);
}
-
-
+
+
q("DELETE FROM tokens WHERE id='%s'", $token->key);
-
-
+
+
if (!is_null($ret) && $uverifier!==false) {
- del_config("oauth", $verifier);
-
+ Config::Delete("oauth", $verifier);
+
// $apps = get_pconfig($uverifier, "oauth", "apps");
// if ($apps===false) $apps=array();
// $apps[] = $consumer->key;
@@ -145,7 +147,7 @@ class ZotOAuth1 extends OAuth1Server {
$this->add_signature_method(new OAuth1SignatureMethod_PLAINTEXT());
$this->add_signature_method(new OAuth1SignatureMethod_HMAC_SHA1());
}
-
+
function loginUser($uid){
logger("ZotOAuth1::loginUser $uid");
@@ -174,7 +176,7 @@ class ZotOAuth1 extends OAuth1Server {
$_SESSION['allow_api'] = true;
}
}
-
+
}
/*
@@ -195,13 +197,13 @@ class FKOAuth2 extends OAuth2 {
dbesc($client_secret),
dbesc($redirect_uri)
);
-
+
return $r;
}
protected function checkClientCredentials($client_id, $client_secret = NULL) {
$client_secret = $this->db_secret($client_secret);
-
+
$r = q("SELECT pw FROM clients WHERE client_id = '%s'",
dbesc($client_id));
@@ -223,21 +225,21 @@ class FKOAuth2 extends OAuth2 {
protected function getAccessToken($oauth_token) {
$r = q("SELECT client_id, expires, scope FROM tokens WHERE id = '%s'",
dbesc($oauth_token));
-
+
if (count($r))
return $r[0];
return null;
}
-
+
protected function setAccessToken($oauth_token, $client_id, $expires, $scope = NULL) {
$r = q("INSERT INTO tokens (id, client_id, expires, scope) VALUES ('%s', '%s', %d, '%s')",
dbesc($oauth_token),
dbesc($client_id),
intval($expires),
dbesc($scope));
-
+
return $r;
}
@@ -251,23 +253,23 @@ class FKOAuth2 extends OAuth2 {
protected function getAuthCode($code) {
$r = q("SELECT id, client_id, redirect_uri, expires, auth_scope FROM auth_codes WHERE id = '%s'",
dbesc($code));
-
+
if (count($r))
return $r[0];
return null;
}
protected function setAuthCode($code, $client_id, $redirect_uri, $expires, $scope = NULL) {
- $r = q("INSERT INTO auth_codes
- (id, client_id, redirect_uri, expires, auth_scope) VALUES
+ $r = q("INSERT INTO auth_codes
+ (id, client_id, redirect_uri, expires, auth_scope) VALUES
('%s', '%s', '%s', %d, '%s')",
dbesc($code),
dbesc($client_id),
dbesc($redirect_uri),
intval($expires),
dbesc($scope));
- return $r;
- }
-
+ return $r;
+ }
+
}
*/
diff --git a/include/oauth2.php b/include/oauth2.php
index 3a71a651d..f7a279892 100644
--- a/include/oauth2.php
+++ b/include/oauth2.php
@@ -12,12 +12,12 @@
$oauth2_server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
$oauth2_server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage));
- $keyStorage = new OAuth2\Storage\Memory( [
- 'keys' => [
- 'public_key' => get_config('system','pubkey'),
- 'private_key' => get_config('system','prvkey')
+ $keyStorage = new OAuth2\Storage\Memory( [
+ 'keys' => [
+ 'public_key' => Config::Get('system','pubkey'),
+ 'private_key' => Config::Get('system','prvkey')
]
]);
$oauth2_server->addStorage($keyStorage,'public_key');
-*/ \ No newline at end of file
+*/
diff --git a/include/oembed.php b/include/oembed.php
index a90c91641..1b6157241 100644
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -1,7 +1,7 @@
<?php /** @file */
use Zotlabs\Lib\Cache;
-
+use Zotlabs\Lib\Config;
function oembed_replacecb($matches){
@@ -28,7 +28,7 @@ function oembed_action($embedurl) {
logger('oembed_action: ' . $embedurl, LOGGER_DEBUG, LOG_INFO);
if(strpos($embedurl,'http://') === 0) {
- if(intval(get_config('system','embed_sslonly'))) {
+ if(intval(Config::Get('system','embed_sslonly'))) {
$action = 'block';
}
}
@@ -39,7 +39,7 @@ function oembed_action($embedurl) {
// site white/black list
- if(($x = get_config('system','embed_deny'))) {
+ if(($x = Config::Get('system','embed_deny'))) {
if(($x) && (! is_array($x)))
$x = explode("\n",$x);
if($x) {
@@ -55,7 +55,7 @@ function oembed_action($embedurl) {
$found = false;
- if(($x = get_config('system','embed_allow'))) {
+ if(($x = Config::Get('system','embed_allow'))) {
if(($x) && (! is_array($x)))
$x = explode("\n",$x);
if($x) {
@@ -139,16 +139,16 @@ function oembed_fetch_url($embedurl){
// we should try to cache this and avoid a lookup on each render
$is_matrix = is_matrix_url($embedurl);
- $zrl = ((get_config('system','oembed_zrl')) ? $is_matrix : false);
+ $zrl = ((Config::Get('system','oembed_zrl')) ? $is_matrix : false);
$furl = ((local_channel() && $zrl) ? zid($embedurl) : $embedurl);
- if($action !== 'block' && (! get_config('system','oembed_cache_disable'))) {
+ if($action !== 'block' && (! Config::Get('system','oembed_cache_disable'))) {
$txt = Cache::get('[' . App::$videowidth . '] ' . $furl);
}
- if(strpos(strtolower($embedurl),'.pdf') !== false && get_config('system','inline_pdf')) {
+ if(strpos(strtolower($embedurl),'.pdf') !== false && Config::Get('system','inline_pdf')) {
$action = 'allow';
$j = [
'html' => '<object data="' . $embedurl . '" type="application/pdf" style="width: 100%; height: 300px;"></object>',
@@ -164,7 +164,7 @@ function oembed_fetch_url($embedurl){
$txt = EMPTY_STR;
if ($action !== 'block') {
- $max_oembed_size = get_config('system', 'oembed_max_size', 1 * 1024 * 1024 /* 1MB */);
+ $max_oembed_size = Config::Get('system', 'oembed_max_size', 1 * 1024 * 1024 /* 1MB */);
stream_context_set_default(
[
@@ -259,7 +259,7 @@ function oembed_fetch_url($embedurl){
// save in cache
- if(! get_config('system','oembed_cache_disable'))
+ if(! Config::Get('system','oembed_cache_disable'))
Cache::set('[' . App::$videowidth . '] ' . $furl, $txt);
}
@@ -429,7 +429,7 @@ function oembed_iframe($src,$width,$height) {
function oembed_bbcode2html($text){
- $stopoembed = get_config("system","no_oembed");
+ $stopoembed = Config::Get("system","no_oembed");
if ($stopoembed == true){
return preg_replace("/\[embed\](.+?)\[\/embed\]/is", "<!-- oembed $1 --><i>". t('Embedding disabled') ." : $1</i><!-- /oembed $1 -->" ,$text);
}
diff --git a/include/permissions.php b/include/permissions.php
index 28f242712..be6fc8594 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -1,5 +1,7 @@
<?php
+use Zotlabs\Lib\Config;
+
require_once('include/security.php');
/**
@@ -105,7 +107,7 @@ function get_all_perms($uid, $observer_xchan, $check_siteblock = true, $default_
// system is blocked to anybody who is not authenticated
- if(($check_siteblock) && (! $observer_xchan) && intval(get_config('system', 'block_public'))) {
+ if(($check_siteblock) && (! $observer_xchan) && intval(Config::Get('system', 'block_public'))) {
$ret[$perm_name] = 0;
continue;
}
@@ -291,7 +293,7 @@ function perm_is_allowed($uid, $observer_xchan, $permission, $check_siteblock =
// system is blocked to anybody who is not authenticated
- if(($check_siteblock) && (! $observer_xchan) && intval(get_config('system', 'block_public')))
+ if(($check_siteblock) && (! $observer_xchan) && intval(Config::Get('system', 'block_public')))
return false;
// Check if this $uid is actually the $observer_xchan
@@ -496,7 +498,7 @@ function site_default_perms() {
$global_perms = \Zotlabs\Access\Permissions::Perms();
foreach($global_perms as $perm => $v) {
- $x = get_config('default_perms', $perm, $typical[$perm]);
+ $x = Config::Get('default_perms', $perm, $typical[$perm]);
$ret[$perm] = $x;
}
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 4394d3238..66a5d19f9 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -1,5 +1,6 @@
<?php
+use Zotlabs\Lib\Config;
use Zotlabs\Photo\PhotoDriver;
use Zotlabs\Photo\PhotoGd;
use Zotlabs\Photo\PhotoImagick;
@@ -32,13 +33,13 @@ function photo_factory($data, $type = null) {
return null;
}
- $ignore_imagick = get_config('system', 'ignore_imagick');
+ $ignore_imagick = Config::Get('system', 'ignore_imagick');
if(class_exists('Imagick') && !$ignore_imagick) {
$v = Imagick::getVersion();
preg_match('/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $v['versionString'], $m);
if(version_compare($m[1], '6.6.7') >= 0) {
- $limits = get_config('system', 'imagick_limits', false);
+ $limits = Config::Get('system', 'imagick_limits', false);
if ($limits)
foreach ($limits as $k => $v)
IMagick::setResourceLimit($k, $v);
@@ -99,7 +100,7 @@ function guess_image_type($filename, $data = '') {
}
if(is_null($type)){
- $ignore_imagick = get_config('system', 'ignore_imagick');
+ $ignore_imagick = Config::Get('system', 'ignore_imagick');
// Guessing from extension? Isn't that... dangerous?
if(class_exists('Imagick') && ! $ignore_imagick) {
$v = Imagick::getVersion();
diff --git a/include/photos.php b/include/photos.php
index 5e993e15f..85c97d1fd 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -6,6 +6,7 @@
use Zotlabs\Access\PermissionLimits;
use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\Config;
require_once('include/permissions.php');
require_once('include/items.php');
@@ -74,11 +75,11 @@ function photo_upload($channel, $observer, $args) {
$os_storage = 0;
- $max_thumb = get_config('system', 'max_thumbnail', 1600);
+ $max_thumb = Config::Get('system', 'max_thumbnail', 1600);
if ($args['os_syspath'] && $args['getimagesize']) {
if ($args['getimagesize'][0] > $max_thumb || $args['getimagesize'][1] > $max_thumb) {
- $imagick_path = get_config('system', 'imagick_convert_path');
+ $imagick_path = Config::Get('system', 'imagick_convert_path');
if ($imagick_path && @file_exists($imagick_path)) {
$tmp_name = $args['os_syspath'] . '-001';
$newsize = photo_calculate_scale(array_merge($args['getimagesize'], ['max' => $max_thumb]));
@@ -146,7 +147,7 @@ function photo_upload($channel, $observer, $args) {
logger('Received file: ' . $filename . ' as ' . $src . ' (' . $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG);
- $maximagesize = get_config('system', 'maximagesize');
+ $maximagesize = Config::Get('system', 'maximagesize');
if (($maximagesize) && ($filesize > $maximagesize)) {
$ret['message'] = sprintf(t('Image exceeds website size limit of %lu bytes'), $maximagesize);
@@ -219,7 +220,7 @@ function photo_upload($channel, $observer, $args) {
@unlink($src);
- $max_length = get_config('system', 'max_image_length');
+ $max_length = Config::Get('system', 'max_image_length');
if (!$max_length)
$max_length = MAX_IMAGE_LENGTH;
if ($max_length > 0)
diff --git a/include/plugin.php b/include/plugin.php
index bbfeab988..4601cb544 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -5,6 +5,7 @@
* @brief Some functions to handle addons and themes.
*/
+use Zotlabs\Lib\Config;
/**
* @brief Handle errors in plugin calls.
@@ -25,7 +26,7 @@ function handleerrors_plugin($plugin, $notice, $log, $uninstall = false){
$idx = array_search($plugin, \App::$plugins);
unset(\App::$plugins[$idx]);
uninstall_plugin($plugin);
- set_config("system", "addon", implode(", ", \App::$plugins));
+ Config::Set("system", "addon", implode(", ", \App::$plugins));
}
}
@@ -187,7 +188,7 @@ function plugin_is_installed($name) {
* @brief Reload all updated plugins.
*/
function reload_plugins() {
- $plugins = get_config('system', 'addon');
+ $plugins = Config::Get('system', 'addon');
if(strlen($plugins)) {
$r = dbq("SELECT * FROM addon WHERE installed = 1");
if($r)
@@ -266,7 +267,7 @@ function plugins_sync() {
$installed = plugins_installed_list();
- $plugins = get_config('system', 'addon', '');
+ $plugins = Config::Get('system', 'addon', '');
$plugins_arr = explode(',', $plugins);
@@ -719,7 +720,7 @@ function check_plugin_versions($info) {
continue;
if(strpos($test,'.')) {
$conf = explode('.',$test);
- if(get_config(trim($conf[0]),trim($conf[1])))
+ if(Config::Get(trim($conf[0]),trim($conf[1])))
return true;
else
return false;
diff --git a/include/security.php b/include/security.php
index b3e45742e..bc44704d0 100644
--- a/include/security.php
+++ b/include/security.php
@@ -5,6 +5,8 @@
* @brief Some security related functions.
*/
+use Zotlabs\Lib\Config;
+
/**
* @param int $user_record The account_id
* @param array $channel
@@ -872,7 +874,7 @@ function stream_perms_xchans($perms = NULL) {
*/
function zarIsDuty($wd=NULL, $hhmm=NULL, $op='isOpen') {
- $isduty = get_config('system', 'register_duty_jso');
+ $isduty = Config::Get('system', 'register_duty_jso');
if (!$isduty)
return (bool)false;
diff --git a/include/socgraph.php b/include/socgraph.php
index e5e8ddf74..336c1c0c3 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -1,6 +1,7 @@
<?php /** @file */
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Zotfinger;
@@ -288,7 +289,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
function update_suggestions() {
- $dirmode = get_config('system', 'directory_mode', DIRECTORY_MODE_NORMAL);
+ $dirmode = Config::Get('system', 'directory_mode', DIRECTORY_MODE_NORMAL);
if($dirmode == DIRECTORY_MODE_STANDALONE) {
poco_load('', z_root() . '/poco');
diff --git a/include/statistics_fns.php b/include/statistics_fns.php
index 98b0efd41..5915c82a2 100644
--- a/include/statistics_fns.php
+++ b/include/statistics_fns.php
@@ -1,13 +1,15 @@
<?php /** @file */
+use Zotlabs\Lib\Config;
+
function update_channels_total_stat() {
$r = q("select count(channel_id) as channels_total from channel left join account on account_id = channel_account_id
where account_flags = 0 ");
if($r) {
$channels_total_stat = intval($r[0]['channels_total']);
- set_config('system','channels_total_stat',$channels_total_stat);
+ Config::Set('system','channels_total_stat',$channels_total_stat);
} else {
- set_config('system','channels_total_stat',0);
+ Config::Set('system','channels_total_stat',0);
}
}
@@ -17,10 +19,10 @@ function update_channels_active_halfyear_stat() {
db_utcnow(), db_quoteinterval('6 MONTH')
);
if($r) {
- set_config('system','channels_active_halfyear_stat',count($r));
+ Config::Set('system','channels_active_halfyear_stat',count($r));
}
else {
- set_config('system','channels_active_halfyear_stat','0');
+ Config::Set('system','channels_active_halfyear_stat','0');
}
}
@@ -30,10 +32,10 @@ function update_channels_active_monthly_stat() {
db_utcnow(), db_quoteinterval('1 MONTH')
);
if($r) {
- set_config('system','channels_active_monthly_stat',count($r));
+ Config::Set('system','channels_active_monthly_stat',count($r));
}
else {
- set_config('system','channels_active_monthly_stat','0');
+ Config::Set('system','channels_active_monthly_stat','0');
}
}
@@ -41,9 +43,9 @@ function update_local_posts_stat() {
$posts = q("SELECT COUNT(*) AS local_posts FROM item WHERE item_wall = 1 and id = parent");
if (is_array($posts)) {
$local_posts_stat = intval($posts[0]["local_posts"]);
- set_config('system','local_posts_stat',$local_posts_stat);
+ Config::Set('system','local_posts_stat',$local_posts_stat);
} else {
- set_config('system','local_posts_stat',0);
+ Config::Set('system','local_posts_stat',0);
}
}
@@ -54,5 +56,5 @@ function update_local_comments_stat() {
else
$local_posts = $posts[0]["local_posts"];
- set_config('system','local_comments_stat', $local_posts);
-} \ No newline at end of file
+ Config::Set('system','local_comments_stat', $local_posts);
+}
diff --git a/include/taxonomy.php b/include/taxonomy.php
index 90ccb6142..49b364154 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -6,6 +6,7 @@
// To do this we need to escape these characters if they appear in our tag.
use Zotlabs\Lib\Cache;
+use Zotlabs\Lib\Config;
function file_tag_encode($s) {
@@ -351,7 +352,7 @@ function pub_tagadelic($net, $site, $limit, $recent, $safemode, $type) {
}
if($safemode) {
- $unsafetags = get_config('system','unsafepubtags', [ 'boobs', 'bot', 'rss', 'girl','girls', 'nsfw', 'sexy', 'nude' ]);
+ $unsafetags = Config::Get('system','unsafepubtags', [ 'boobs', 'bot', 'rss', 'girl','girls', 'nsfw', 'sexy', 'nude' ]);
if($unsafetags) {
$sql_extra .= " and not term.term in ( " . stringify_array($unsafetags,true) . ") ";
}
diff --git a/include/text.php b/include/text.php
index 713911af2..b9ec90e92 100644
--- a/include/text.php
+++ b/include/text.php
@@ -9,6 +9,7 @@ use Michelf\MarkdownExtra;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Exception\UnableToBuildUuidException;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Crypto;
use Zotlabs\Lib\SvgSanitizer;
use Zotlabs\Lib\Libzot;
@@ -741,9 +742,9 @@ function logger($msg, $level = LOGGER_NORMAL, $priority = LOG_INFO) {
$loglevel = LOGGER_ALL;
}
else {
- $debugging = get_config('system', 'debugging');
- $loglevel = intval(get_config('system', 'loglevel'));
- $logfile = get_config('system', 'logfile');
+ $debugging = Config::Get('system', 'debugging');
+ $loglevel = intval(Config::Get('system', 'loglevel'));
+ $logfile = Config::Get('system', 'logfile');
}
if((! $debugging) || (! $logfile) || ($level > $loglevel))
@@ -846,9 +847,9 @@ function dlogger($msg, $level = 0) {
if(App::$module == 'setup')
return;
- $debugging = get_config('system','debugging');
- $loglevel = intval(get_config('system','loglevel'));
- $logfile = get_config('system','dlogfile');
+ $debugging = Config::Get('system','debugging');
+ $loglevel = intval(Config::Get('system','loglevel'));
+ $logfile = Config::Get('system','dlogfile');
if((! $debugging) || (! $logfile) || ($level > $loglevel))
return;
@@ -1253,7 +1254,7 @@ function sslify($s) {
// The downside is that http: media files will likely be blocked by your browser
// Complain to your browser maker
- $allow = get_config('system','sslify_everything');
+ $allow = Config::Get('system','sslify_everything');
$pattern = (($allow) ? "/\<(.*?)src=[\"|'](http\:.*?)[\"|'](.*?)\>/" : "/\<img(.*?)src=[\"|'](http\:.*?)[\"|'](.*?)\>/" );
$matches = null;
@@ -1407,7 +1408,7 @@ function list_smilies($default_only = false) {
*/
function smilies($s, $sample = false) {
- if(intval(get_config('system', 'no_smilies'))
+ if(intval(Config::Get('system', 'no_smilies'))
|| (local_channel() && intval(get_pconfig(local_channel(), 'system', 'no_smilies'))))
return $s;
@@ -2113,7 +2114,7 @@ function create_export_photo_body(&$item) {
* @return string
*/
function feed_hublinks() {
- $hub = get_config('system', 'huburl');
+ $hub = Config::Get('system', 'huburl');
$hubxml = '';
if(strlen($hub)) {
@@ -2496,7 +2497,7 @@ function check_webbie($arr) {
// These names conflict with the CalDAV server
$taken = [ 'principals', 'addressbooks', 'calendars' ];
- $reservechan = get_config('system','reserved_channels');
+ $reservechan = Config::Get('system','reserved_channels');
if(strlen($reservechan)) {
$taken = array_merge($taken,explode(',', $reservechan));
}
diff --git a/include/zid.php b/include/zid.php
index b38457d99..9f0b23edf 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -1,5 +1,6 @@
<?php
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Verify;
@@ -406,7 +407,7 @@ function owt_init($token) {
App::set_observer($hubloc);
require_once('include/security.php');
App::set_groups(init_groups_visitor($_SESSION['visitor_id']));
- if(! get_config('system', 'hide_owa_greeting'))
+ if(! Config::Get('system', 'hide_owa_greeting'))
info(sprintf( t('OpenWebAuth: %1$s welcomes %2$s'),App::get_hostname(), $hubloc['xchan_name']));
logger('OpenWebAuth: auth success from ' . $hubloc['xchan_addr']);