aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--Zotlabs/Access/PermissionRoles.php4
-rw-r--r--Zotlabs/Daemon/Cache_query.php7
-rw-r--r--Zotlabs/Daemon/Checksites.php4
-rw-r--r--Zotlabs/Daemon/Cron.php21
-rw-r--r--Zotlabs/Daemon/Cron_daily.php7
-rw-r--r--Zotlabs/Daemon/Cron_weekly.php4
-rw-r--r--Zotlabs/Daemon/Directory.php3
-rw-r--r--Zotlabs/Daemon/Expire.php16
-rw-r--r--Zotlabs/Daemon/Master.php2
-rw-r--r--Zotlabs/Daemon/Notifier.php7
-rw-r--r--Zotlabs/Daemon/Onepoll.php5
-rw-r--r--Zotlabs/Daemon/Poller.php16
-rw-r--r--Zotlabs/Daemon/Thumbnail.php7
-rw-r--r--Zotlabs/Extend/Route.php5
-rw-r--r--Zotlabs/Extend/Widget.php5
-rw-r--r--Zotlabs/Identity/OAuth2Server.php6
-rw-r--r--Zotlabs/Lib/Apps.php9
-rw-r--r--Zotlabs/Lib/Cache.php9
-rw-r--r--Zotlabs/Lib/Connect.php5
-rw-r--r--Zotlabs/Lib/Crypto.php3
-rw-r--r--Zotlabs/Lib/DB_Upgrade.php29
-rw-r--r--Zotlabs/Lib/DReport.php4
-rw-r--r--Zotlabs/Lib/Enotify.php9
-rw-r--r--Zotlabs/Lib/Libsync.php5
-rw-r--r--Zotlabs/Lib/Libzot.php43
-rw-r--r--Zotlabs/Lib/Libzotdir.php27
-rw-r--r--Zotlabs/Lib/QueueWorker.php23
-rw-r--r--Zotlabs/Lib/ThreadItem.php17
-rw-r--r--Zotlabs/Lib/Zotfinger.php3
-rw-r--r--Zotlabs/Module/Acl.php7
-rw-r--r--Zotlabs/Module/Admin.php4
-rw-r--r--Zotlabs/Module/Admin/Accounts.php6
-rw-r--r--Zotlabs/Module/Admin/Addons.php7
-rw-r--r--Zotlabs/Module/Admin/Dbsync.php14
-rw-r--r--Zotlabs/Module/Admin/Features.php44
-rw-r--r--Zotlabs/Module/Admin/Logs.php49
-rw-r--r--Zotlabs/Module/Admin/Profs.php57
-rw-r--r--Zotlabs/Module/Admin/Queueworker.php17
-rw-r--r--Zotlabs/Module/Admin/Security.php73
-rw-r--r--Zotlabs/Module/Admin/Site.php257
-rw-r--r--Zotlabs/Module/Admin/Themes.php5
-rw-r--r--Zotlabs/Module/Api.php4
-rw-r--r--Zotlabs/Module/Apps.php4
-rw-r--r--Zotlabs/Module/Channel.php3
-rw-r--r--Zotlabs/Module/Cover_photo.php7
-rw-r--r--Zotlabs/Module/Dircensor.php6
-rw-r--r--Zotlabs/Module/Directory.php16
-rw-r--r--Zotlabs/Module/Dirsearch.php7
-rw-r--r--Zotlabs/Module/Display.php3
-rw-r--r--Zotlabs/Module/Email_validation.php9
-rw-r--r--Zotlabs/Module/Fhublocs.php3
-rw-r--r--Zotlabs/Module/Go.php9
-rw-r--r--Zotlabs/Module/Group.php7
-rw-r--r--Zotlabs/Module/Home.php13
-rw-r--r--Zotlabs/Module/Import.php9
-rw-r--r--Zotlabs/Module/Invite.php23
-rw-r--r--Zotlabs/Module/Linkinfo.php3
-rw-r--r--Zotlabs/Module/Lostpass.php10
-rw-r--r--Zotlabs/Module/New_channel.php11
-rw-r--r--Zotlabs/Module/Profile_photo.php3
-rw-r--r--Zotlabs/Module/Profiles.php5
-rw-r--r--Zotlabs/Module/Profperm.php87
-rw-r--r--Zotlabs/Module/Pubsites.php5
-rw-r--r--Zotlabs/Module/Pubstream.php13
-rw-r--r--Zotlabs/Module/Regate.php9
-rw-r--r--Zotlabs/Module/Regdir.php31
-rw-r--r--Zotlabs/Module/Register.php55
-rw-r--r--Zotlabs/Module/Search.php7
-rw-r--r--Zotlabs/Module/Service_limits.php14
-rw-r--r--Zotlabs/Module/Settings/Account.php4
-rw-r--r--Zotlabs/Module/Settings/Channel.php7
-rw-r--r--Zotlabs/Module/Settings/Display.php7
-rw-r--r--Zotlabs/Module/Settings/Privacy.php3
-rw-r--r--Zotlabs/Module/Setup.php7
-rw-r--r--Zotlabs/Module/Siteinfo.php7
-rw-r--r--Zotlabs/Module/Sse.php5
-rw-r--r--Zotlabs/Module/Sse_bs.php7
-rw-r--r--Zotlabs/Module/Well_known.php3
-rw-r--r--Zotlabs/Module/Wfinger.php3
-rw-r--r--Zotlabs/Photo/PhotoDriver.php5
-rw-r--r--Zotlabs/Photo/PhotoGd.php8
-rw-r--r--Zotlabs/Photo/PhotoImagick.php8
-rw-r--r--Zotlabs/Render/Comanche.php28
-rw-r--r--Zotlabs/Render/SmartyTemplate.php2
-rw-r--r--Zotlabs/Storage/Browser.php7
-rw-r--r--Zotlabs/Storage/Directory.php9
-rw-r--r--Zotlabs/Storage/File.php3
-rw-r--r--Zotlabs/Thumbs/Pdf.php3
-rw-r--r--Zotlabs/Thumbs/Video.php3
-rw-r--r--Zotlabs/Update/_1103.php6
-rw-r--r--Zotlabs/Update/_1226.php7
-rw-r--r--Zotlabs/Update/_1236.php11
-rw-r--r--Zotlabs/Update/_1242.php6
-rw-r--r--Zotlabs/Update/_1243.php12
-rw-r--r--Zotlabs/Web/HTTPSig.php5
-rw-r--r--Zotlabs/Web/Router.php5
-rw-r--r--Zotlabs/Web/Session.php13
-rw-r--r--Zotlabs/Widget/Newmember.php6
-rw-r--r--Zotlabs/Widget/Pinned.php4
-rw-r--r--Zotlabs/Widget/Pubtagcloud.php8
-rw-r--r--Zotlabs/Widget/Rating.php4
-rw-r--r--boot.php56
-rw-r--r--doc/dev-function-overview.md10
-rw-r--r--doc/developer_function_primer.bb4
-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
-rw-r--r--tests/unit/Photo/PhotoGdTest.php17
-rw-r--r--tests/unit/Web/HttpSigTest.php5
-rwxr-xr-xutil/addons20
-rwxr-xr-xutil/config17
-rwxr-xr-xutil/db_update.php4
-rwxr-xr-xutil/service_class34
-rwxr-xr-xutil/storageconv21
-rw-r--r--view/theme/redbasic/php/theme_init.php6
145 files changed, 1223 insertions, 1011 deletions
diff --git a/Zotlabs/Access/PermissionRoles.php b/Zotlabs/Access/PermissionRoles.php
index 2078b52a8..5dfedfcd7 100644
--- a/Zotlabs/Access/PermissionRoles.php
+++ b/Zotlabs/Access/PermissionRoles.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Access;
+use Zotlabs\Lib\Config;
+
/**
* @brief PermissionRoles class.
*
@@ -247,7 +249,7 @@ class PermissionRoles {
break;
}
- $x = get_config('system','role_perms');
+ $x = Config::Get('system','role_perms');
// let system settings over-ride any or all
if($x && is_array($x) && array_key_exists($role,$x))
diff --git a/Zotlabs/Daemon/Cache_query.php b/Zotlabs/Daemon/Cache_query.php
index cd9597e9a..8e5c6b2ea 100644
--- a/Zotlabs/Daemon/Cache_query.php
+++ b/Zotlabs/Daemon/Cache_query.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\Cache;
+use Zotlabs\Lib\Config;
class Cache_query {
@@ -13,14 +14,14 @@ class Cache_query {
$key = $argv[1];
- $pid = get_config('procid', $key, false);
+ $pid = Config::Get('procid', $key, false);
if ($pid && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) {
logger($key . ': procedure already run with pid ' . $pid, LOGGER_DEBUG);
return;
}
$pid = getmypid();
- set_config('procid', $key, $pid);
+ Config::Set('procid', $key, $pid);
array_shift($argv);
array_shift($argv);
@@ -31,7 +32,7 @@ class Cache_query {
if($r)
Cache::set($key, serialize($r));
- del_config('procid', $key);
+ Config::Delete('procid', $key);
return;
}
diff --git a/Zotlabs/Daemon/Checksites.php b/Zotlabs/Daemon/Checksites.php
index eacf8c6bc..8f6319edb 100644
--- a/Zotlabs/Daemon/Checksites.php
+++ b/Zotlabs/Daemon/Checksites.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
+
require_once('include/hubloc.php');
class Checksites {
@@ -19,7 +21,7 @@ class Checksites {
if ($site_id)
$sql_options = " and site_url = '" . dbesc($argv[1]) . "' ";
- $days = intval(get_config('system', 'sitecheckdays'));
+ $days = intval(Config::Get('system', 'sitecheckdays'));
if ($days < 1)
$days = 30;
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index e0fa2d629..d2c863572 100644
--- a/Zotlabs/Daemon/Cron.php
+++ b/Zotlabs/Daemon/Cron.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Libzotdir;
@@ -9,7 +10,7 @@ class Cron {
static public function run($argc, $argv) {
- $maxsysload = intval(get_config('system', 'maxloadavg'));
+ $maxsysload = intval(Config::Get('system', 'maxloadavg'));
if ($maxsysload < 1)
$maxsysload = 50;
if (function_exists('sys_getloadavg')) {
@@ -24,7 +25,7 @@ class Cron {
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
$lockfile = 'store/[data]/cron';
if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 3600))
- && (!get_config('system', 'override_cron_lockfile'))) {
+ && (!Config::Get('system', 'override_cron_lockfile'))) {
logger("cron: Already running");
return;
}
@@ -41,7 +42,7 @@ class Cron {
// Pull remote changes and push local changes.
// potential issue: how do we keep from creating an endless update loop?
- $dirmode = get_config('system', 'directory_mode');
+ $dirmode = Config::Get('system', 'directory_mode');
if ($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
Libzotdir::sync_directories($dirmode);
@@ -64,7 +65,7 @@ class Cron {
require_once('include/account.php');
remove_expired_registrations();
- $interval = get_config('queueworker', 'queue_interval', 500000);
+ $interval = Config::Get('queueworker', 'queue_interval', 500000);
// expire any expired items
@@ -124,13 +125,13 @@ class Cron {
$r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
intval(PHOTO_CACHE),
db_utcnow(),
- db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
+ db_quoteinterval(Config::Get('system', 'cache_expire_days', 7) . ' DAY')
);
if ($r) {
q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
intval(PHOTO_CACHE),
db_utcnow(),
- db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
+ db_quoteinterval(Config::Get('system', 'cache_expire_days', 7) . ' DAY')
);
foreach ($r as $rr) {
$file = dbunescbin($rr['content']);
@@ -185,13 +186,13 @@ class Cron {
// FIXME: add birthday updates, both locally and for xprof for use
// by directory servers
- $d1 = intval(get_config('system', 'last_expire_day'));
+ $d1 = intval(Config::Get('system', 'last_expire_day'));
$d2 = intval(datetime_convert('UTC', 'UTC', 'now', 'd'));
// Allow somebody to staggger daily activities if they have more than one site on their server,
// or if it happens at an inconvenient (busy) hour.
- $h1 = intval(get_config('system', 'cron_hour'));
+ $h1 = intval(Config::Get('system', 'cron_hour'));
$h2 = intval(datetime_convert('UTC', 'UTC', 'now', 'G'));
@@ -225,7 +226,7 @@ class Cron {
// pull in some public posts if allowed
- $disable_externals = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false || get_config('system', 'site_firehose');
+ $disable_externals = Config::Get('system', 'disable_discover_tab') || Config::Get('system', 'disable_discover_tab') === false || Config::Get('system', 'site_firehose');
if (!$disable_externals)
Master::Summon(['Externals']);
@@ -245,7 +246,7 @@ class Cron {
if (!$restart)
Master::Summon(array('Cronhooks'));
- set_config('system', 'lastcron', datetime_convert());
+ Config::Set('system', 'lastcron', datetime_convert());
//All done - clear the lockfile
//@unlink($lockfile);
diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php
index 98379be1b..3bc267f08 100644
--- a/Zotlabs/Daemon/Cron_daily.php
+++ b/Zotlabs/Daemon/Cron_daily.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzotdir;
class Cron_daily {
@@ -68,7 +69,7 @@ class Cron_daily {
// Clean up cache
q("DELETE FROM cache WHERE updated < %s - INTERVAL %s",
db_utcnow(),
- db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
+ db_quoteinterval(Config::Get('system', 'cache_expire_days', 7) . ' DAY')
);
//update statistics in config
@@ -82,7 +83,7 @@ class Cron_daily {
// expire old delivery reports
- $keep_reports = intval(get_config('system', 'expire_delivery_reports'));
+ $keep_reports = intval(Config::Get('system', 'expire_delivery_reports'));
if ($keep_reports === 0)
$keep_reports = 10;
@@ -103,7 +104,7 @@ class Cron_daily {
$date = datetime_convert();
call_hooks('cron_daily', $date);
- set_config('system', 'last_expire_day', intval(datetime_convert('UTC', 'UTC', 'now', 'd')));
+ Config::Set('system', 'last_expire_day', intval(datetime_convert('UTC', 'UTC', 'now', 'd')));
/**
* End Cron Daily
diff --git a/Zotlabs/Daemon/Cron_weekly.php b/Zotlabs/Daemon/Cron_weekly.php
index 75fb94700..f9ea5aae7 100644
--- a/Zotlabs/Daemon/Cron_weekly.php
+++ b/Zotlabs/Daemon/Cron_weekly.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
+
class Cron_weekly {
static public function run($argc, $argv) {
@@ -44,7 +46,7 @@ class Cron_weekly {
db_utcnow(), db_quoteinterval('14 DAY')
);
- $dirmode = intval(get_config('system', 'directory_mode'));
+ $dirmode = intval(Config::Get('system', 'directory_mode'));
if ($dirmode === DIRECTORY_MODE_SECONDARY || $dirmode === DIRECTORY_MODE_PRIMARY) {
logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . urlencode(z_root()) . '&realm=' . urlencode(get_directory_realm())), true));
}
diff --git a/Zotlabs/Daemon/Directory.php b/Zotlabs/Daemon/Directory.php
index 19adf8273..1c4c29ac2 100644
--- a/Zotlabs/Daemon/Directory.php
+++ b/Zotlabs/Daemon/Directory.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Queue;
@@ -25,7 +26,7 @@ class Directory {
logger('directory update', LOGGER_DEBUG);
- $dirmode = get_config('system', 'directory_mode');
+ $dirmode = Config::Get('system', 'directory_mode');
if ($dirmode === false)
$dirmode = DIRECTORY_MODE_NORMAL;
diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php
index 6ab67150f..ad52a6b71 100644
--- a/Zotlabs/Daemon/Expire.php
+++ b/Zotlabs/Daemon/Expire.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
+
require_once('include/items.php');
class Expire {
@@ -10,14 +12,14 @@ class Expire {
cli_startup();
- $pid = get_config('procid', 'expire', false);
+ $pid = Config::Get('procid', 'expire', false);
if ($pid && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) {
logger('procedure already run with pid ' . $pid, LOGGER_DEBUG);
return;
}
$pid = getmypid();
- set_config('procid', 'expire', $pid);
+ Config::Set('procid', 'expire', $pid);
// perform final cleanup on previously delete items
@@ -38,13 +40,13 @@ class Expire {
db_quoteinterval('36 DAY')
);
- if (intval(get_config('system', 'optimize_items')))
+ if (intval(Config::Get('system', 'optimize_items')))
q("optimize table item");
logger('expire: start with pid ' . $pid, LOGGER_DEBUG);
- $site_expire = intval(get_config('system', 'default_expire_days', 30));
- $commented_days = intval(get_config('system', 'active_expire_days', 7));
+ $site_expire = intval(Config::Get('system', 'default_expire_days', 30));
+ $commented_days = intval(Config::Get('system', 'active_expire_days', 7));
logger('site_expire: ' . $site_expire);
@@ -84,7 +86,7 @@ class Expire {
// this should probably just fetch the channel_expire_days from the sys channel,
// but there's no convenient way to set it.
- $expire_days = get_config('system', 'sys_expire_days');
+ $expire_days = Config::Get('system', 'sys_expire_days');
if ($expire_days === false)
$expire_days = 30;
@@ -101,7 +103,7 @@ class Expire {
logger('Expire: sys: done', LOGGER_DEBUG);
}
- del_config('procid', 'expire');
+ Config::Delete('procid', 'expire');
return;
}
diff --git a/Zotlabs/Daemon/Master.php b/Zotlabs/Daemon/Master.php
index c9ed91aaa..d28e462dd 100644
--- a/Zotlabs/Daemon/Master.php
+++ b/Zotlabs/Daemon/Master.php
@@ -37,7 +37,7 @@ class Master {
return;
}
- $phpbin = get_config('system', 'phpbin', 'php');
+ $phpbin = Config::Get('system', 'phpbin', 'php');
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', $arr);
*/
}
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index 4e7ca3911..20134b8fe 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -2,8 +2,9 @@
namespace Zotlabs\Daemon;
-use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\Config;
+use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Queue;
require_once('include/html2plain.php');
@@ -668,7 +669,7 @@ class Notifier {
);
// only create delivery reports for normal undeleted items
- if (is_array($target_item) && (!$target_item['item_deleted']) && (!get_config('system', 'disable_dreport'))) {
+ if (is_array($target_item) && (!$target_item['item_deleted']) && (!Config::Get('system', 'disable_dreport'))) {
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan, dreport_queue )
values ( '%s', '%s','%s','%s','%s','%s','%s','%s' ) ",
dbesc($target_item['mid']),
@@ -698,7 +699,7 @@ class Notifier {
do_delivery(self::$deliveries);
}
- if ($dead_hosts && is_array($target_item) && (!$target_item['item_deleted']) && (!get_config('system', 'disable_dreport'))) {
+ if ($dead_hosts && is_array($target_item) && (!$target_item['item_deleted']) && (!Config::Get('system', 'disable_dreport'))) {
foreach ($dead_hosts as $deceased_host) {
$r = q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan, dreport_queue )
values ( '%s', '%s','%s','%s','%s','%s','%s','%s' ) ",
diff --git a/Zotlabs/Daemon/Onepoll.php b/Zotlabs/Daemon/Onepoll.php
index 973bcf402..e525d138c 100644
--- a/Zotlabs/Daemon/Onepoll.php
+++ b/Zotlabs/Daemon/Onepoll.php
@@ -5,6 +5,7 @@ namespace Zotlabs\Daemon;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\ASCollection;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
require_once('include/socgraph.php');
@@ -25,7 +26,7 @@ class Onepoll {
}
$sql_extra = '';
- $allow_feeds = get_config('system', 'feed_contacts');
+ $allow_feeds = Config::Get('system', 'feed_contacts');
if(!$allow_feeds) {
$sql_extra = ' and abook_feed = 0 ';
}
@@ -125,7 +126,7 @@ class Onepoll {
if ($fetch_feed) {
- $max = intval(get_config('system', 'max_imported_posts', 30));
+ $max = intval(Config::Get('system', 'max_imported_posts', 30));
if (intval($max)) {
$cl = Activity::get_actor_collections($contact['abook_xchan']);
diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php
index 77a428ec3..2103310b9 100644
--- a/Zotlabs/Daemon/Poller.php
+++ b/Zotlabs/Daemon/Poller.php
@@ -2,11 +2,13 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
+
class Poller {
static public function run($argc, $argv) {
- $maxsysload = intval(get_config('system', 'maxloadavg'));
+ $maxsysload = intval(Config::Get('system', 'maxloadavg'));
if ($maxsysload < 1)
$maxsysload = 50;
if (function_exists('sys_getloadavg')) {
@@ -17,7 +19,7 @@ class Poller {
}
}
- $interval = get_config('queueworker', 'queue_interval', 500000);
+ $interval = Config::Get('queueworker', 'queue_interval', 500000);
logger('poller: start');
@@ -43,13 +45,13 @@ class Poller {
reload_plugins();
// Only poll from those with suitable relationships
- $abandon_days = intval(get_config('system', 'account_abandon_days', 0));
+ $abandon_days = intval(Config::Get('system', 'account_abandon_days', 0));
$abandon_sql = (($abandon_days)
? sprintf(" AND account_lastlog > %s - INTERVAL %s ", db_utcnow(), db_quoteinterval(intval($abandon_days) . ' DAY'))
: ''
);
- $allow_feeds = get_config('system', 'feed_contacts');
+ $allow_feeds = Config::Get('system', 'feed_contacts');
if(!$allow_feeds) {
$sql_extra .= ' and abook_feed = 0 ';
}
@@ -81,7 +83,7 @@ class Poller {
if (intval($contact['abook_feed'])) {
$min = service_class_fetch($contact['abook_channel'], 'minimum_feedcheck_minutes');
if (!$min)
- $min = intval(get_config('system', 'minimum_feedcheck_minutes'));
+ $min = intval(Config::Get('system', 'minimum_feedcheck_minutes'));
if (!$min)
$min = 60;
@@ -167,7 +169,7 @@ class Poller {
}
}
- $dirmode = intval(get_config('system', 'directory_mode'));
+ $dirmode = intval(Config::Get('system', 'directory_mode'));
if ($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
$r = q("SELECT * FROM updates WHERE ud_update = 1 AND (ud_last = '%s' OR ud_last > %s - INTERVAL %s)",
@@ -195,7 +197,7 @@ class Poller {
}
}
- set_config('system', 'lastpoll', datetime_convert());
+ Config::Set('system', 'lastpoll', datetime_convert());
return;
}
diff --git a/Zotlabs/Daemon/Thumbnail.php b/Zotlabs/Daemon/Thumbnail.php
index fa9570658..85fcb8b72 100644
--- a/Zotlabs/Daemon/Thumbnail.php
+++ b/Zotlabs/Daemon/Thumbnail.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
class Thumbnail {
@@ -19,9 +20,9 @@ class Thumbnail {
$attach = $c[0];
- $preview_style = intval(get_config('system', 'thumbnail_security', 0));
- $preview_width = intval(get_config('system', 'thumbnail_width', 300));
- $preview_height = intval(get_config('system', 'thumbnail_height', 300));
+ $preview_style = intval(Config::Get('system', 'thumbnail_security', 0));
+ $preview_width = intval(Config::Get('system', 'thumbnail_width', 300));
+ $preview_height = intval(Config::Get('system', 'thumbnail_height', 300));
$p = [
'attach' => $attach,
diff --git a/Zotlabs/Extend/Route.php b/Zotlabs/Extend/Route.php
index f7b90ec6e..95b83e11b 100644
--- a/Zotlabs/Extend/Route.php
+++ b/Zotlabs/Extend/Route.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Extend;
+use Zotlabs\Lib\Config;
class Route {
@@ -38,11 +39,11 @@ class Route {
}
static function get() {
- return get_config('system','routes',[]);
+ return Config::Get('system','routes',[]);
}
static function set($r) {
- return set_config('system','routes',$r);
+ return Config::Set('system','routes',$r);
}
}
diff --git a/Zotlabs/Extend/Widget.php b/Zotlabs/Extend/Widget.php
index dee64c61b..6ab95237d 100644
--- a/Zotlabs/Extend/Widget.php
+++ b/Zotlabs/Extend/Widget.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Extend;
+use Zotlabs\Lib\Config;
class Widget {
@@ -38,10 +39,10 @@ class Widget {
}
static function get() {
- return get_config('system','widgets',[]);
+ return Config::Get('system','widgets',[]);
}
static function set($r) {
- return set_config('system','widgets',$r);
+ return Config::Set('system','widgets',$r);
}
}
diff --git a/Zotlabs/Identity/OAuth2Server.php b/Zotlabs/Identity/OAuth2Server.php
index b747b95db..67326b599 100644
--- a/Zotlabs/Identity/OAuth2Server.php
+++ b/Zotlabs/Identity/OAuth2Server.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Identity;
+use Zotlabs\Lib\Config;
+
class OAuth2Server extends \OAuth2\Server {
public function __construct(OAuth2Storage $storage, $config = null) {
@@ -24,8 +26,8 @@ class OAuth2Server extends \OAuth2\Server {
$keyStorage = new \OAuth2\Storage\Memory( [
'keys' => [
- 'public_key' => get_config('system', 'pubkey'),
- 'private_key' => get_config('system', 'prvkey')
+ 'public_key' => Config::Get('system', 'pubkey'),
+ 'private_key' => Config::Get('system', 'prvkey')
]
]);
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 1c05d69b1..0dc405ea9 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Lib;
use App;
+use Zotlabs\Lib\Config;
require_once('include/plugin.php');
require_once('include/channel.php');
@@ -65,7 +66,7 @@ class Apps {
}
static public function get_base_apps() {
- $x = get_config('system','base_apps',[
+ $x = Config::Get('system','base_apps',[
'Connections',
'Contact Roles',
'Network',
@@ -301,7 +302,7 @@ class Apps {
break;
default:
if($config)
- $unset = ((get_config('system', $require[0]) == $require[1]) ? false : true);
+ $unset = ((Config::Get('system', $require[0]) == $require[1]) ? false : true);
else
$unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true);
if($unset)
@@ -523,7 +524,7 @@ class Apps {
break;
default:
if($config)
- $unset = ((get_config('system', $require[0]) === $require[1]) ? false : true);
+ $unset = ((Config::Get('system', $require[0]) === $require[1]) ? false : true);
else
$unset = ((local_channel() && feature_enabled(local_channel(),$require)) ? false : true);
if($unset)
@@ -960,7 +961,7 @@ class Apps {
$conf = (($menu === 'nav_featured_app') ? 'app_order' : 'app_pin_order');
- $x = (($uid) ? get_pconfig($uid,'system',$conf) : get_config('system',$conf));
+ $x = (($uid) ? get_pconfig($uid,'system',$conf) : Config::Get('system',$conf));
if(($x) && (! is_array($x))) {
$y = explode(',',$x);
$y = array_map('trim',$y);
diff --git a/Zotlabs/Lib/Cache.php b/Zotlabs/Lib/Cache.php
index f3f520496..4b5beb2aa 100644
--- a/Zotlabs/Lib/Cache.php
+++ b/Zotlabs/Lib/Cache.php
@@ -2,10 +2,11 @@
namespace Zotlabs\Lib;
- /**
- * cache api
- */
+use Zotlabs\Lib\Config;
+/**
+ * cache api
+ */
class Cache {
/**
@@ -23,7 +24,7 @@ class Cache {
$r = q("SELECT v FROM cache WHERE k = '%s' AND updated > %s - INTERVAL %s LIMIT 1",
dbesc($hash),
db_utcnow(),
- db_quoteinterval(($age ? $age : get_config('system','object_cache_days', '30') . ' DAY'))
+ db_quoteinterval(($age ? $age : Config::Get('system','object_cache_days', '30') . ' DAY'))
);
if ($r)
diff --git a/Zotlabs/Lib/Connect.php b/Zotlabs/Lib/Connect.php
index 4de41526b..b8e7a5c4e 100644
--- a/Zotlabs/Lib/Connect.php
+++ b/Zotlabs/Lib/Connect.php
@@ -5,8 +5,7 @@ namespace Zotlabs\Lib;
use App;
use Zotlabs\Access\Permissions;
use Zotlabs\Daemon\Master;
-
-
+use Zotlabs\Lib\Config;
class Connect {
@@ -96,7 +95,7 @@ class Connect {
$wf = discover_by_webbie($url,$protocol);
if (! $wf) {
- $feeds = get_config('system','feed_contacts');
+ $feeds = Config::Get('system','feed_contacts');
if (($feeds) && (in_array($protocol, [ '', 'feed', 'rss' ]))) {
$d = discover_by_url($url);
diff --git a/Zotlabs/Lib/Crypto.php b/Zotlabs/Lib/Crypto.php
index 188c6bd81..46a25d3b5 100644
--- a/Zotlabs/Lib/Crypto.php
+++ b/Zotlabs/Lib/Crypto.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Lib;
use Exception;
+use Zotlabs\Lib\Config;
class Crypto {
@@ -44,7 +45,7 @@ class Crypto {
'encrypt_key' => false
];
- $conf = get_config('system', 'openssl_conf_file');
+ $conf = Config::Get('system', 'openssl_conf_file');
if ($conf) {
$openssl_options['config'] = $conf;
diff --git a/Zotlabs/Lib/DB_Upgrade.php b/Zotlabs/Lib/DB_Upgrade.php
index b6e3f7b7b..981c354a4 100644
--- a/Zotlabs/Lib/DB_Upgrade.php
+++ b/Zotlabs/Lib/DB_Upgrade.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Lib;
+use Zotlabs\Lib\Config;
class DB_Upgrade {
@@ -13,9 +14,9 @@ class DB_Upgrade {
$this->config_name = 'db_version';
$this->func_prefix = '_';
- $build = get_config('system', 'db_version', 0);
+ $build = Config::Get('system', 'db_version', 0);
if(! intval($build))
- $build = set_config('system', 'db_version', $db_revision);
+ $build = Config::Set('system', 'db_version', $db_revision);
if($build == $db_revision) {
// Nothing to be done.
@@ -27,7 +28,7 @@ class DB_Upgrade {
logger('Critical: check_config unable to determine database schema version');
return;
}
-
+
$current = intval($db_revision);
if($stored < $current) {
@@ -38,7 +39,7 @@ class DB_Upgrade {
for($x = $stored + 1; $x <= $current; $x ++) {
$s = '_' . $x;
$cls = '\\Zotlabs\Update\\' . $s ;
- if(! class_exists($cls)) {
+ if(! class_exists($cls)) {
return;
}
@@ -52,10 +53,10 @@ class DB_Upgrade {
Config::Load('database');
- if(get_config('database', $s))
+ if(Config::Get('database', $s))
break;
- set_config('database',$s, '1');
-
+ Config::Set('database',$s, '1');
+
$c = new $cls();
@@ -65,10 +66,10 @@ class DB_Upgrade {
$source = t('Source code of failed update: ') . "\n\n" . @file_get_contents('Zotlabs/Update/' . $s . '.php');
-
+
// Prevent sending hundreds of thousands of emails by creating
- // a lockfile.
+ // a lockfile.
$lockfile = 'store/[data]/mailsent';
@@ -77,7 +78,7 @@ class DB_Upgrade {
@unlink($lockfile);
//send the administrator an e-mail
file_put_contents($lockfile, $x);
-
+
$r = q("select account_language from account where account_email = '%s' limit 1",
dbesc(\App::$config['system']['admin_email'])
);
@@ -86,7 +87,7 @@ class DB_Upgrade {
[
'toEmail' => \App::$config['system']['admin_email'],
'messageSubject' => sprintf( t('Update Error at %s'), z_root()),
- 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'),
+ 'textVersion' => replace_macros(get_intltext_template('update_fail_eml.tpl'),
[
'$sitename' => \App::$config['system']['sitename'],
'$siteurl' => z_root(),
@@ -104,11 +105,11 @@ class DB_Upgrade {
pop_lang();
}
else {
- set_config('database',$s, 'success');
+ Config::Set('database',$s, 'success');
}
}
}
- set_config('system', 'db_version', $db_revision);
+ Config::Set('system', 'db_version', $db_revision);
}
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Lib/DReport.php b/Zotlabs/Lib/DReport.php
index 71e39a9d7..ac8e0d377 100644
--- a/Zotlabs/Lib/DReport.php
+++ b/Zotlabs/Lib/DReport.php
@@ -1,6 +1,8 @@
<?php
namespace Zotlabs\Lib;
+use Zotlabs\Lib\Config;
+
class DReport {
private $location;
@@ -70,7 +72,7 @@ class DReport {
static function is_storable($dr) {
- if(get_config('system', 'disable_dreport'))
+ if(Config::Get('system', 'disable_dreport'))
return false;
/**
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 48a255e95..121ad9b09 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -6,6 +6,7 @@ namespace Zotlabs\Lib;
* @brief File with functions and a class for generating system and email notifications.
*/
+use Zotlabs\Lib\Config;
class Enotify {
@@ -61,7 +62,7 @@ class Enotify {
$product = t('$projectname'); // PLATFORM_NAME;
$siteurl = z_root();
$thanks = t('Thank You,');
- $sitename = get_config('system','sitename');
+ $sitename = Config::Get('system','sitename');
$site_admin = sprintf( t('%s Administrator'), $sitename);
$opt_out1 = sprintf( t('This email was sent by %1$s at %2$s.'), t('$Projectname'), \App::get_hostname());
$opt_out2 = sprintf( t('To stop receiving these messages, please adjust your Notification Settings at %s'), z_root() . '/settings');
@@ -73,15 +74,15 @@ class Enotify {
// Do not translate 'noreply' as it must be a legal 7-bit email address
- $reply_email = get_config('system', 'reply_address');
+ $reply_email = Config::Get('system', 'reply_address');
if(! $reply_email)
$reply_email = 'noreply' . '@' . $hostname;
- $sender_email = get_config('system', 'from_email');
+ $sender_email = Config::Get('system', 'from_email');
if(! $sender_email)
$sender_email = 'Administrator' . '@' . $hostname;
- $sender_name = get_config('system', 'from_email_name');
+ $sender_name = Config::Get('system', 'from_email_name');
if(! $sender_name)
$sender_name = \Zotlabs\Lib\System::get_site_name();
diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php
index 3130290f7..e68fd53f1 100644
--- a/Zotlabs/Lib/Libsync.php
+++ b/Zotlabs/Lib/Libsync.php
@@ -5,6 +5,7 @@ namespace Zotlabs\Lib;
use App;
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
class Libsync {
@@ -135,7 +136,7 @@ class Libsync {
$info['collection_members'] = $r;
}
- $interval = get_config('queueworker', 'queue_interval', 500000);
+ $interval = Config::Get('queueworker', 'queue_interval', 500000);
logger('Packet: ' . print_r($info, true), LOGGER_DATA, LOG_DEBUG);
@@ -157,7 +158,7 @@ class Libsync {
/*
$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))) {
+ if (intval($x[0]['total']) > intval(Config::Get('system', 'force_queue_threshold', 3000))) {
logger('immediate delivery deferred.', LOGGER_DEBUG, LOG_INFO);
Queue::update($hash);
continue;
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 3495ede06..89157bf5e 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -3,10 +3,11 @@
namespace Zotlabs\Lib;
use App;
-use Zotlabs\Web\HTTPSig;
-use Zotlabs\Access\Permissions;
use Zotlabs\Access\PermissionLimits;
+use Zotlabs\Access\Permissions;
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
+use Zotlabs\Web\HTTPSig;
require_once('include/crypto.php');
@@ -101,12 +102,12 @@ class Libzot {
*/
static function build_packet($channel, $type = 'activity', $recipients = null, $msg = [], $encoding = 'activitystreams', $remote_key = null, $methods = '') {
- $sig_method = get_config('system', 'signature_algorithm', 'sha256');
+ $sig_method = Config::Get('system', 'signature_algorithm', 'sha256');
$data = [
'type' => $type,
'encoding' => $encoding,
'sender' => $channel['channel_hash'],
- 'site_id' => self::make_xchan_hash(z_root(), get_config('system', 'pubkey')),
+ 'site_id' => self::make_xchan_hash(z_root(), Config::Get('system', 'pubkey')),
'version' => System::get_zot_revision(),
];
@@ -661,7 +662,7 @@ class Libzot {
*/
call_hooks('import_xchan', $arr);
- $dirmode = intval(get_config('system', 'directory_mode', DIRECTORY_MODE_NORMAL));
+ $dirmode = intval(Config::Get('system', 'directory_mode', DIRECTORY_MODE_NORMAL));
$changed = false;
$what = '';
@@ -710,7 +711,7 @@ class Libzot {
// if we import an entry from a site that's not ours and either or both of us is off the grid - hide the entry.
/** @TODO: check if we're the same directory realm, which would mean we are allowed to see it */
- $dirmode = get_config('system', 'directory_mode');
+ $dirmode = Config::Get('system', 'directory_mode');
if (((isset($arr['site']['directory_mode']) && $arr['site']['directory_mode'] === 'standalone') || ($dirmode & DIRECTORY_MODE_STANDALONE)) && ($arr['site']['url'] != z_root()))
$arr['searchable'] = false;
@@ -1008,7 +1009,7 @@ class Libzot {
logger('Headers: ' . print_r($arr['header'], true), LOGGER_DATA, LOG_DEBUG);
}
- $x = Crypto::unencapsulate($x, get_config('system', 'prvkey'));
+ $x = Crypto::unencapsulate($x, Config::Get('system', 'prvkey'));
if ($x && !is_array($x)) {
$x = json_decode($x, true);
@@ -1416,7 +1417,7 @@ class Libzot {
$include_sys = false;
if ($msg['type'] === 'activity') {
- $disable_discover_tab = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false;
+ $disable_discover_tab = Config::Get('system', 'disable_discover_tab') || Config::Get('system', 'disable_discover_tab') === false;
if (!$disable_discover_tab)
$include_sys = true;
@@ -1632,8 +1633,8 @@ class Libzot {
continue;
}
- $incl = get_config('system','pubstream_incl');
- $excl = get_config('system','pubstream_excl');
+ $incl = Config::Get('system','pubstream_incl');
+ $excl = Config::Get('system','pubstream_excl');
if(($incl || $excl) && !MessageFilter::evaluate($arr, $incl, $excl)) {
$local_public = false;
@@ -2924,8 +2925,8 @@ class Libzot {
*/
static function site_info() {
- $signing_key = get_config('system', 'prvkey');
- $sig_method = get_config('system', 'signature_algorithm', 'sha256');
+ $signing_key = Config::Get('system', 'prvkey');
+ $sig_method = Config::Get('system', 'signature_algorithm', 'sha256');
$ret = [];
$ret['site'] = [];
@@ -2934,10 +2935,10 @@ class Libzot {
$ret['site']['post'] = z_root() . '/zot';
$ret['site']['openWebAuth'] = z_root() . '/owa';
$ret['site']['authRedirect'] = z_root() . '/magic';
- $ret['site']['sitekey'] = get_config('system', 'pubkey');
+ $ret['site']['sitekey'] = Config::Get('system', 'pubkey');
$ret['site']['directory_mode'] = 'normal';
- $dirmode = get_config('system', 'directory_mode');
+ $dirmode = Config::Get('system', 'directory_mode');
if ($dirmode == DIRECTORY_MODE_PRIMARY)
$ret['site']['directory_mode'] = 'primary';
@@ -2956,7 +2957,7 @@ class Libzot {
if ($dirmode != DIRECTORY_MODE_STANDALONE) {
- $register_policy = intval(get_config('system', 'register_policy'));
+ $register_policy = intval(Config::Get('system', 'register_policy'));
if ($register_policy == REGISTER_CLOSED)
$ret['site']['register_policy'] = 'closed';
@@ -2966,7 +2967,7 @@ class Libzot {
$ret['site']['register_policy'] = 'open';
- $access_policy = intval(get_config('system', 'access_policy'));
+ $access_policy = intval(Config::Get('system', 'access_policy'));
if ($access_policy == ACCESS_PRIVATE)
$ret['site']['access_policy'] = 'private';
@@ -2982,7 +2983,7 @@ class Libzot {
require_once('include/channel.php');
$ret['site']['channels'] = channel_total();
- $ret['site']['admin'] = get_config('system', 'admin_email');
+ $ret['site']['admin'] = Config::Get('system', 'admin_email');
$visible_plugins = [];
if (is_array(App::$plugins) && count(App::$plugins)) {
@@ -2993,10 +2994,10 @@ class Libzot {
}
$ret['site']['plugins'] = $visible_plugins;
- $ret['site']['sitehash'] = get_config('system', 'location_hash');
- $ret['site']['sitename'] = get_config('system', 'sitename');
- $ret['site']['sellpage'] = get_config('system', 'sellpage');
- $ret['site']['location'] = get_config('system', 'site_location');
+ $ret['site']['sitehash'] = Config::Get('system', 'location_hash');
+ $ret['site']['sitename'] = Config::Get('system', 'sitename');
+ $ret['site']['sellpage'] = Config::Get('system', 'sellpage');
+ $ret['site']['location'] = Config::Get('system', 'site_location');
$ret['site']['realm'] = get_directory_realm();
$ret['site']['project'] = System::get_platform_name();
$ret['site']['version'] = System::get_project_version();
diff --git a/Zotlabs/Lib/Libzotdir.php b/Zotlabs/Lib/Libzotdir.php
index ca3902a9e..25f308fc2 100644
--- a/Zotlabs/Lib/Libzotdir.php
+++ b/Zotlabs/Lib/Libzotdir.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Lib;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Zotfinger;
use Zotlabs\Lib\Webfinger;
@@ -20,7 +21,7 @@ class Libzotdir {
static function find_upstream_directory($dirmode) {
- $preferred = get_config('system','directory_server');
+ $preferred = Config::Get('system','directory_server');
// Thwart attempts to use a private directory
@@ -47,17 +48,17 @@ class Libzotdir {
$directory_fallback_servers = get_directory_fallback_servers();
- $dirmode = intval(get_config('system','directory_mode'));
+ $dirmode = intval(Config::Get('system','directory_mode'));
if ($dirmode == DIRECTORY_MODE_NORMAL) {
$toss = mt_rand(0,count($directory_fallback_servers));
$preferred = $directory_fallback_servers[$toss];
if(! $preferred) {
$preferred = DIRECTORY_FALLBACK_MASTER;
}
- set_config('system','directory_server',$preferred);
+ Config::Set('system','directory_server',$preferred);
}
else {
- set_config('system','directory_server',z_root());
+ Config::Set('system','directory_server',z_root());
}
}
if($preferred) {
@@ -77,7 +78,7 @@ class Libzotdir {
static function check_upstream_directory() {
- $directory = get_config('system', 'directory_server');
+ $directory = Config::Get('system', 'directory_server');
// it's possible there is no directory server configured and the local hub is being used.
// If so, default to preserving the absence of a specific server setting.
@@ -94,7 +95,7 @@ class Libzotdir {
}
if (! $isadir)
- set_config('system', 'directory_server', '');
+ Config::Set('system', 'directory_server', '');
}
@@ -106,7 +107,7 @@ class Libzotdir {
$ret = ((array_key_exists($setting,$_SESSION)) ? intval($_SESSION[$setting]) : false);
if($ret === false)
- $ret = get_config('directory', $setting);
+ $ret = Config::Get('directory', $setting);
// 'safemode' is the default if there is no observer or no established preference.
@@ -114,7 +115,7 @@ class Libzotdir {
if($setting === 'safemode' && $ret === false)
$ret = 1;
- if($setting === 'globaldir' && intval(get_config('system','localdir_hide')))
+ if($setting === 'globaldir' && intval(Config::Get('system','localdir_hide')))
$ret = 1;
return $ret;
@@ -133,7 +134,7 @@ class Libzotdir {
$globaldir = self::get_directory_setting($observer, 'globaldir');
$pubforums = self::get_directory_setting($observer, 'pubforums');
- $hide_local = intval(get_config('system','localdir_hide'));
+ $hide_local = intval(Config::Get('system','localdir_hide'));
if($hide_local)
$globaldir = 1;
@@ -141,7 +142,7 @@ class Libzotdir {
// Build urls without order and pubforums so it's easy to tack on the changed value
// Probably there's an easier way to do this
- $directory_sort_order = get_config('system','directory_sort_order');
+ $directory_sort_order = Config::Get('system','directory_sort_order');
if(! $directory_sort_order)
$directory_sort_order = 'date';
@@ -232,7 +233,7 @@ class Libzotdir {
if (! $r)
return;
- $dir_trusted_hosts = array_merge(get_directory_fallback_servers(), get_config('system', 'trusted_directory_servers', []));
+ $dir_trusted_hosts = array_merge(get_directory_fallback_servers(), Config::Get('system', 'trusted_directory_servers', []));
foreach ($r as $rr) {
if (! $rr['site_directory'])
@@ -244,7 +245,7 @@ class Libzotdir {
// It will take about a month for a new directory to obtain the full current repertoire of channels.
/** @FIXME Go back and pick up earlier ratings if this is a new directory server. These do not get refreshed. */
- $token = get_config('system','realm_token');
+ $token = Config::Get('system','realm_token');
$syncdate = (($rr['site_sync'] <= NULL_DATE) ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']);
$x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate) . (($token) ? '&t=' . $token : ''));
@@ -696,7 +697,7 @@ class Libzotdir {
static function update($hash, $addr, $bump_date = true, $flag = null) {
- $dirmode = intval(get_config('system', 'directory_mode'));
+ $dirmode = intval(Config::Get('system', 'directory_mode'));
if($dirmode == DIRECTORY_MODE_NORMAL) {
return;
diff --git a/Zotlabs/Lib/QueueWorker.php b/Zotlabs/Lib/QueueWorker.php
index 68e747b0f..ce239809f 100644
--- a/Zotlabs/Lib/QueueWorker.php
+++ b/Zotlabs/Lib/QueueWorker.php
@@ -4,6 +4,7 @@ namespace Zotlabs\Lib;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Exception\UnableToBuildUuidException;
+use Zotlabs\Lib\Config;
class QueueWorker {
@@ -84,7 +85,7 @@ class QueueWorker {
$workers = self::GetWorkerCount();
if ($workers < self::$maxworkers) {
logger($workers . '/' . self::$maxworkers . ' workers active', LOGGER_DEBUG);
- $phpbin = get_config('system', 'phpbin', 'php');
+ $phpbin = Config::Get('system', 'phpbin', 'php');
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', ['Queueworker']);
}
}
@@ -132,18 +133,18 @@ class QueueWorker {
public static function GetWorkerCount() {
if (self::$maxworkers == 0) {
- self::$maxworkers = get_config('queueworker', 'max_queueworkers', 4);
+ self::$maxworkers = Config::Get('queueworker', 'max_queueworkers', 4);
self::$maxworkers = self::$maxworkers > 3 ? self::$maxworkers : 4;
}
if (self::$workermaxage == 0) {
- self::$workermaxage = get_config('queueworker', 'max_queueworker_age');
+ self::$workermaxage = Config::Get('queueworker', 'max_queueworker_age');
self::$workermaxage = self::$workermaxage > 120 ? self::$workermaxage : 300;
}
self::qstart();
// skip locked is preferred but is not supported by mariadb < 10.6 which is still used a lot - hence make it optional
- $sql_quirks = ((get_config('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
+ $sql_quirks = ((Config::Get('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
$r = q("SELECT workerq_id FROM workerq WHERE workerq_reservationid IS NOT NULL AND workerq_processtimeout < %s FOR UPDATE $sql_quirks",
db_utcnow()
@@ -199,7 +200,7 @@ class QueueWorker {
self::qstart();
// skip locked is preferred but is not supported by mariadb < 10.6 which is still used a lot - hence make it optional
- $sql_quirks = ((get_config('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
+ $sql_quirks = ((Config::Get('system', 'db_skip_locked_supported')) ? 'SKIP LOCKED' : 'NOWAIT');
$work = dbq("SELECT workerq_id, workerq_cmd FROM workerq WHERE workerq_reservationid IS NULL ORDER BY workerq_priority DESC, workerq_id ASC LIMIT 1 FOR UPDATE $sql_quirks");
@@ -236,12 +237,12 @@ class QueueWorker {
}
public static function Process() {
- $sleep = intval(get_config('queueworker', 'queue_worker_sleep', 100));
- $auto_queue_worker_sleep = get_config('queueworker', 'auto_queue_worker_sleep', 0);
+ $sleep = intval(Config::Get('queueworker', 'queue_worker_sleep', 100));
+ $auto_queue_worker_sleep = Config::Get('queueworker', 'auto_queue_worker_sleep', 0);
if (!self::GetWorkerID()) {
if ($auto_queue_worker_sleep) {
- set_config('queueworker', 'queue_worker_sleep', $sleep + 100);
+ Config::Set('queueworker', 'queue_worker_sleep', $sleep + 100);
}
logger('Unable to get worker ID. Exiting.', LOGGER_DEBUG);
@@ -250,7 +251,7 @@ class QueueWorker {
if ($auto_queue_worker_sleep && $sleep > 100) {
$next_sleep = $sleep - 100;
- set_config('queueworker', 'queue_worker_sleep', (($next_sleep < 100) ? 100 : $next_sleep));
+ Config::Set('queueworker', 'queue_worker_sleep', (($next_sleep < 100) ? 100 : $next_sleep));
}
$jobs = 0;
@@ -259,7 +260,7 @@ class QueueWorker {
self::$workersleep = $sleep;
self::$workersleep = ((intval(self::$workersleep) > 100) ? intval(self::$workersleep) : 100);
- if (function_exists('sys_getloadavg') && get_config('queueworker', 'load_average_sleep')) {
+ if (function_exists('sys_getloadavg') && Config::Get('queueworker', 'load_average_sleep')) {
// very experimental!
$load_average_sleep = true;
}
@@ -287,7 +288,7 @@ class QueueWorker {
if ($workers < self::$maxworkers) {
logger($workers . '/' . self::$maxworkers . ' workers active', LOGGER_DEBUG);
- $phpbin = get_config('system', 'phpbin', 'php');
+ $phpbin = Config::Get('system', 'phpbin', 'php');
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', ['Queueworker']);
}
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 8f364e945..290a7b0c2 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -3,8 +3,9 @@
namespace Zotlabs\Lib;
use App;
-use Zotlabs\Lib\Apps;
use Zotlabs\Access\AccessList;
+use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
require_once('include/text.php');
@@ -41,7 +42,7 @@ class ThreadItem {
$this->data = $data;
$this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
- $this->threaded = get_config('system','thread_allow');
+ $this->threaded = Config::Get('system','thread_allow');
$observer = \App::get_observer();
@@ -70,7 +71,7 @@ class ThreadItem {
// allow a site to configure the order and content of the reaction emoji list
if($this->toplevel) {
- $x = get_config('system','reactions');
+ $x = Config::Get('system','reactions');
if($x && is_array($x) && count($x)) {
$this->reactions = $x;
}
@@ -347,12 +348,12 @@ class ThreadItem {
$dreport = '';
- $keep_reports = intval(get_config('system','expire_delivery_reports'));
+ $keep_reports = intval(Config::Get('system','expire_delivery_reports'));
if($keep_reports === 0)
$keep_reports = 10;
$dreport_link = '';
- if((intval($item['item_type']) == ITEM_TYPE_POST) && (! get_config('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0) {
+ if((intval($item['item_type']) == ITEM_TYPE_POST) && (! Config::Get('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0) {
$dreport = t('Delivery Report');
$dreport_link = '?mid=' . $item['mid'];
}
@@ -397,7 +398,7 @@ class ThreadItem {
$json_mids = json_encode($mids);
// Pinned item processing
- $allowed_type = (in_array($item['item_type'], get_config('system', 'pin_types', [ ITEM_TYPE_POST ])) ? true : false);
+ $allowed_type = (in_array($item['item_type'], Config::Get('system', 'pin_types', [ ITEM_TYPE_POST ])) ? true : false);
$pinned_items = ($allowed_type ? get_pconfig($item['uid'], 'pinned', $item['item_type'], []) : []);
$pinned = ((!empty($pinned_items) && in_array($midb64, $pinned_items)) ? true : false);
@@ -549,7 +550,7 @@ class ThreadItem {
$result['children'] = array();
$nb_children = count($children);
- $visible_comments = get_config('system','expanded_comments');
+ $visible_comments = Config::Get('system','expanded_comments');
if($visible_comments === false)
$visible_comments = 3;
@@ -826,7 +827,7 @@ class ThreadItem {
*/
private function get_comment_box() {
- if(!$this->is_toplevel() && !get_config('system','thread_allow')) {
+ if(!$this->is_toplevel() && !Config::Get('system','thread_allow')) {
return '';
}
diff --git a/Zotlabs/Lib/Zotfinger.php b/Zotlabs/Lib/Zotfinger.php
index ccf64d6d1..2a16fc8cf 100644
--- a/Zotlabs/Lib/Zotfinger.php
+++ b/Zotlabs/Lib/Zotfinger.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Lib;
+use Zotlabs\Lib\Config;
use Zotlabs\Web\HTTPSig;
class Zotfinger {
@@ -75,7 +76,7 @@ class Zotfinger {
$result['data'] = json_decode($x['body'],true);
if($result['data'] && is_array($result['data']) && array_key_exists('encrypted',$result['data']) && $result['data']['encrypted']) {
- $result['data'] = json_decode(Crypto::unencapsulate($result['data'],get_config('system','prvkey')),true);
+ $result['data'] = json_decode(Crypto::unencapsulate($result['data'],Config::Get('system','prvkey')),true);
}
logger('decrypted: ' . print_r($result,true), LOGGER_DATA);
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index b98f5621e..1de7a3d02 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -2,8 +2,9 @@
namespace Zotlabs\Module;
-use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\AccessList;
+use Zotlabs\Lib\Config;
+use Zotlabs\Lib\Libzotdir;
require_once 'include/acl_selectors.php';
@@ -414,7 +415,7 @@ class Acl extends \Zotlabs\Web\Controller {
return;
}
- $dirmode = intval(get_config('system','directory_mode'));
+ $dirmode = intval(Config::Get('system','directory_mode'));
$search = ((x($_REQUEST,'search')) ? htmlentities($_REQUEST['search'],ENT_COMPAT,'UTF-8',false) : '');
if(! $search || mb_strlen($search) < 2)
return array();
@@ -443,7 +444,7 @@ class Acl extends \Zotlabs\Web\Controller {
$url = $directory['url'] . '/dirsearch';
}
- $token = get_config('system','realm_token');
+ $token = Config::Get('system','realm_token');
$count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 100);
if($url) {
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php
index 59a9e22b2..89eaeccfe 100644
--- a/Zotlabs/Module/Admin.php
+++ b/Zotlabs/Module/Admin.php
@@ -8,6 +8,8 @@
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
+
require_once('include/account.php');
/**
@@ -149,7 +151,7 @@ class Admin extends \Zotlabs\Web\Controller {
'$vmaster' => array( t('Repository version (master)'), $vmaster),
'$vdev' => array( t('Repository version (dev)'), $vdev),
'$upgrade' => $upgrade,
- '$build' => get_config('system', 'db_version')
+ '$build' => Config::Get('system', 'db_version')
));
}
diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php
index b067b4bf6..6f7cb0311 100644
--- a/Zotlabs/Module/Admin/Accounts.php
+++ b/Zotlabs/Module/Admin/Accounts.php
@@ -2,7 +2,7 @@
namespace Zotlabs\Module\Admin;
-
+use Zotlabs\Lib\Config;
class Accounts {
@@ -76,7 +76,7 @@ class Accounts {
if ( $ac['success'] ) {
$rc .= '✔';
- $auto_create = get_config('system','auto_channel_create',1);
+ $auto_create = Config::Get('system','auto_channel_create',1);
if($auto_create) {
$reonar = json_decode($rs[0]['reg_stuff'], true);
@@ -87,7 +87,7 @@ class Accounts {
if($reonar['chan.did1'])
set_aconfig($ac['account']['account_id'], 'register', 'channel_address', $reonar['chan.did1']);
- $permissions_role = get_config('system','default_permissions_role');
+ $permissions_role = Config::Get('system','default_permissions_role');
if($permissions_role)
set_aconfig($ac['account']['account_id'], 'register', 'permissions_role', $permissions_role);
diff --git a/Zotlabs/Module/Admin/Addons.php b/Zotlabs/Module/Admin/Addons.php
index e088353e3..b7cfb651c 100644
--- a/Zotlabs/Module/Admin/Addons.php
+++ b/Zotlabs/Module/Admin/Addons.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Module\Admin;
use App;
+use \Zotlabs\Lib\Config;
use \Zotlabs\Storage\GitRepo;
use \Michelf\MarkdownExtra;
@@ -276,7 +277,7 @@ class Addons {
if ($idz !== false) {
unset(App::$plugins[$idz]);
uninstall_plugin($plugin);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
@@ -297,7 +298,7 @@ class Addons {
$pinstalled = true;
info( sprintf( t("Plugin %s enabled."), $plugin ) );
}
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
if($pinstalled) {
@require_once("addon/$plugin/$plugin.php");
@@ -395,7 +396,7 @@ class Addons {
if ($idz !== false) {
unset(App::$plugins[$idz]);
uninstall_plugin($id);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
diff --git a/Zotlabs/Module/Admin/Dbsync.php b/Zotlabs/Module/Admin/Dbsync.php
index b68e7bbc2..9f202993d 100644
--- a/Zotlabs/Module/Admin/Dbsync.php
+++ b/Zotlabs/Module/Admin/Dbsync.php
@@ -2,7 +2,7 @@
namespace Zotlabs\Module\Admin;
-
+use Zotlabs\Lib\Config;
class Dbsync {
@@ -12,10 +12,10 @@ class Dbsync {
if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') {
// remove the old style config if it exists
- del_config('database', 'update_r' . intval(argv(3)));
- set_config('database', '_' . intval(argv(3)), 'success');
- if(intval(get_config('system','db_version')) < intval(argv(3)))
- set_config('system','db_version',intval(argv(3)));
+ Config::Delete('database', 'update_r' . intval(argv(3)));
+ Config::Set('database', '_' . intval(argv(3)), 'success');
+ if(intval(Config::Get('system','db_version')) < intval(argv(3)))
+ Config::Set('system','db_version',intval(argv(3)));
info( t('Update has been marked successful') . EOL);
goaway(z_root() . '/admin/dbsync');
}
@@ -33,7 +33,7 @@ class Dbsync {
}
elseif($retval === UPDATE_SUCCESS) {
$o .= sprintf( t('Update %s was successfully applied.'), $s);
- set_config('database',$s, 'success');
+ Config::Set('database',$s, 'success');
}
else
$o .= sprintf( t('Verifying update %s did not return a status. Unknown if it succeeded.'), $s);
@@ -60,7 +60,7 @@ class Dbsync {
}
elseif($retval === UPDATE_SUCCESS) {
$o .= sprintf( t('Update %s was successfully applied.'), $s);
- set_config('database',$s, 'success');
+ Config::Set('database',$s, 'success');
}
else
$o .= sprintf( t('Update %s did not return a status. It cannot be determined if it was successful.'), $s);
diff --git a/Zotlabs/Module/Admin/Features.php b/Zotlabs/Module/Admin/Features.php
index 504caae79..e0b3a3fd4 100644
--- a/Zotlabs/Module/Admin/Features.php
+++ b/Zotlabs/Module/Admin/Features.php
@@ -2,53 +2,53 @@
namespace Zotlabs\Module\Admin;
-
+use Zotlabs\Lib\Config;
class Features {
-
+
function post() {
-
+
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
-
+
logger('postvars: ' . print_r($_POST,true));
-
+
$arr = array();
$features = get_features(false);
-
+
foreach($features as $fname => $fdata) {
foreach(array_slice($fdata,1) as $f) {
$feature = $f[0];
-
+
if(array_key_exists('feature_' . $feature,$_POST))
$val = intval($_POST['feature_' . $feature]);
else
$val = 0;
- set_config('feature',$feature,$val);
-
+ Config::Set('feature',$feature,$val);
+
if(array_key_exists('featurelock_' . $feature,$_POST))
- set_config('feature_lock',$feature,$val);
+ Config::Set('feature_lock',$feature,$val);
else
- del_config('feature_lock',$feature);
+ Config::Delete('feature_lock',$feature);
}
}
-
+
goaway(z_root() . '/admin/features' );
-
+
}
-
+
function get() {
-
+
if((argc() > 1) && (argv(1) === 'features')) {
$arr = array();
$features = get_features(false);
-
+
foreach($features as $fname => $fdata) {
$arr[$fname] = array();
$arr[$fname][0] = $fdata[0];
foreach(array_slice($fdata,1) as $f) {
-
- $set = get_config('feature',$f[0]);
+
+ $set = Config::Get('feature',$f[0]);
if($set === false)
$set = $f[3];
$arr[$fname][1][] = array(
@@ -57,7 +57,7 @@ class Features {
);
}
}
-
+
$tpl = get_markup_template("admin_settings_features.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("admin_manage_features"),
@@ -65,10 +65,10 @@ class Features {
'$features' => $arr,
'$submit' => t('Submit'),
));
-
+
return $o;
}
}
-
-} \ No newline at end of file
+
+}
diff --git a/Zotlabs/Module/Admin/Logs.php b/Zotlabs/Module/Admin/Logs.php
index c83fc6a9a..73c890e26 100644
--- a/Zotlabs/Module/Admin/Logs.php
+++ b/Zotlabs/Module/Admin/Logs.php
@@ -2,11 +2,12 @@
namespace Zotlabs\Module\Admin;
+use Zotlabs\Lib\Config;
class Logs {
-
+
/**
* @brief POST handler for logs admin page.
*
@@ -15,20 +16,20 @@ class Logs {
function post() {
if (x($_POST, 'page_logs')) {
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
-
+
$logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
$debugging = ((x($_POST,'debugging')) ? true : false);
$loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
-
- set_config('system','logfile', $logfile);
- set_config('system','debugging', $debugging);
- set_config('system','loglevel', $loglevel);
+
+ Config::Set('system','logfile', $logfile);
+ Config::Set('system','debugging', $debugging);
+ Config::Set('system','loglevel', $loglevel);
}
-
+
info( t('Log settings updated.') );
goaway(z_root() . '/admin/logs' );
}
-
+
/**
* @brief Logs admin page.
*
@@ -36,7 +37,7 @@ class Logs {
*/
function get() {
-
+
$log_choices = Array(
LOGGER_NORMAL => 'Normal',
LOGGER_TRACE => 'Trace',
@@ -44,15 +45,15 @@ class Logs {
LOGGER_DATA => 'Data',
LOGGER_ALL => 'All'
);
-
+
$t = get_markup_template('admin_logs.tpl');
-
- $f = get_config('system', 'logfile');
-
+
+ $f = Config::Get('system', 'logfile');
+
$data = '';
-
+
if(!file_exists($f)) {
- $data = t("Error trying to open <strong>$f</strong> log file.\r\n<br/>Check to see if file $f exist and is
+ $data = t("Error trying to open <strong>$f</strong> log file.\r\n<br/>Check to see if file $f exist and is
readable.");
}
else {
@@ -77,7 +78,7 @@ class Logs {
fclose($fp);
}
}
-
+
return replace_macros($t, array(
'$title' => t('Administration'),
'$page' => t('Logs'),
@@ -85,17 +86,17 @@ class Logs {
'$clear' => t('Clear'),
'$data' => $data,
'$baseurl' => z_root(),
- '$logname' => get_config('system','logfile'),
-
+ '$logname' => Config::Get('system','logfile'),
+
// name, label, value, help string, extra data...
- '$debugging' => array('debugging', t("Debugging"),get_config('system','debugging'), ""),
- '$logfile' => array('logfile', t("Log file"), get_config('system','logfile'), t("Must be writable by web server. Relative to your top-level webserver directory.")),
- '$loglevel' => array('loglevel', t("Log level"), get_config('system','loglevel'), "", $log_choices),
-
+ '$debugging' => array('debugging', t("Debugging"),Config::Get('system','debugging'), ""),
+ '$logfile' => array('logfile', t("Log file"), Config::Get('system','logfile'), t("Must be writable by web server. Relative to your top-level webserver directory.")),
+ '$loglevel' => array('loglevel', t("Log level"), Config::Get('system','loglevel'), "", $log_choices),
+
'$form_security_token' => get_form_security_token('admin_logs'),
));
}
-
-} \ No newline at end of file
+
+}
diff --git a/Zotlabs/Module/Admin/Profs.php b/Zotlabs/Module/Admin/Profs.php
index eb2501d43..9965cab19 100644
--- a/Zotlabs/Module/Admin/Profs.php
+++ b/Zotlabs/Module/Admin/Profs.php
@@ -2,11 +2,12 @@
namespace Zotlabs\Module\Admin;
+use Zotlabs\Lib\Config;
class Profs {
function post() {
-
+
if(array_key_exists('basic',$_REQUEST)) {
$arr = explode(',',$_REQUEST['basic']);
array_walk($arr,'array_trim');
@@ -19,9 +20,9 @@ class Profs {
}
}
if(! $narr)
- del_config('system','profile_fields_basic');
+ Config::Delete('system','profile_fields_basic');
else
- set_config('system','profile_fields_basic',$narr);
+ Config::Set('system','profile_fields_basic',$narr);
if(array_key_exists('advanced',$_REQUEST)) {
@@ -36,15 +37,15 @@ class Profs {
}
}
if(! $narr)
- del_config('system','profile_fields_advanced');
+ Config::Delete('system','profile_fields_advanced');
else
- set_config('system','profile_fields_advanced',$narr);
+ Config::Set('system','profile_fields_advanced',$narr);
}
goaway(z_root() . '/admin/profs');
}
-
-
+
+
if(array_key_exists('field_name',$_REQUEST)) {
if($_REQUEST['id']) {
$r = q("update profdef set field_name = '%s', field_type = '%s', field_desc = '%s' field_help = '%s', field_inputs = '%s' where id = %d",
@@ -66,24 +67,24 @@ class Profs {
);
}
}
-
-
+
+
// add to chosen array basic or advanced
-
+
goaway(z_root() . '/admin/profs');
}
-
+
function get() {
-
+
if((argc() > 3) && argv(2) == 'drop' && intval(argv(3))) {
$r = q("delete from profdef where id = %d",
intval(argv(3))
);
// remove from allowed fields
-
- goaway(z_root() . '/admin/profs');
+
+ goaway(z_root() . '/admin/profs');
}
-
+
if((argc() > 2) && argv(2) === 'new') {
return replace_macros(get_markup_template('profdef_edit.tpl'),array(
'$header' => t('New Profile Field'),
@@ -94,7 +95,7 @@ class Profs {
'$submit' => t('Save')
));
}
-
+
if((argc() > 2) && intval(argv(2))) {
$r = q("select * from profdef where id = %d limit 1",
intval(argv(2))
@@ -103,7 +104,7 @@ class Profs {
notice( t('Field definition not found') . EOL);
goaway(z_root() . '/admin/profs');
}
-
+
return replace_macros(get_markup_template('profdef_edit.tpl'),array(
'$id' => intval($r[0]['id']),
'$header' => t('Edit Profile Field'),
@@ -114,7 +115,7 @@ class Profs {
'$submit' => t('Save')
));
}
-
+
$basic = '';
$barr = array();
$fields = get_profile_fields_basic();
@@ -129,7 +130,7 @@ class Profs {
$barr[] = trim($k);
}
}
-
+
$advanced = '';
$fields = get_profile_fields_advanced();
if(! $fields)
@@ -143,7 +144,7 @@ class Profs {
$advanced .= trim($k);
}
}
-
+
$all = '';
$fields = get_profile_fields_advanced(1);
if($fields) {
@@ -153,7 +154,7 @@ class Profs {
$all .= trim($k);
}
}
-
+
$r = q("select * from profdef where true");
if($r) {
foreach($r as $rr) {
@@ -162,8 +163,8 @@ class Profs {
$all .= $rr['field_name'];
}
}
-
-
+
+
$o = replace_macros(get_markup_template('admin_profiles.tpl'),array(
'$title' => t('Profile Fields'),
'$basic' => array('basic',t('Basic Profile Fields'),$basic,''),
@@ -174,17 +175,17 @@ class Profs {
'$cust_fields' => $r,
'$edit' => t('Edit'),
'$drop' => t('Delete'),
- '$new' => t('Create Custom Field'),
+ '$new' => t('Create Custom Field'),
'$submit' => t('Submit')
));
-
+
return $o;
-
-
+
+
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Admin/Queueworker.php b/Zotlabs/Module/Admin/Queueworker.php
index a4f38d07c..c98df6ac0 100644
--- a/Zotlabs/Module/Admin/Queueworker.php
+++ b/Zotlabs/Module/Admin/Queueworker.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Module\Admin;
use App;
+use Zotlabs\Lib\Config;
use Zotlabs\Web\Controller;
class Queueworker extends Controller {
@@ -17,18 +18,18 @@ class Queueworker extends Controller {
$maxqueueworkers = intval($_POST['queueworker_maxworkers']);
$maxqueueworkers = ($maxqueueworkers > 3) ? $maxqueueworkers : 4;
- set_config('queueworker', 'max_queueworkers', $maxqueueworkers);
+ Config::Set('queueworker', 'max_queueworkers', $maxqueueworkers);
$maxworkerage = intval($_POST['queueworker_max_age']);
$maxworkerage = ($maxworkerage >= 120) ? $maxworkerage : 300;
- set_config('queueworker', 'queueworker_max_age', $maxworkerage);
+ Config::Set('queueworker', 'queueworker_max_age', $maxworkerage);
$queueworkersleep = intval($_POST['queue_worker_sleep']);
$queueworkersleep = ($queueworkersleep > 100) ? $queueworkersleep : 100;
- set_config('queueworker', 'queue_worker_sleep', $queueworkersleep);
+ Config::Set('queueworker', 'queue_worker_sleep', $queueworkersleep);
$auto_queue_worker_sleep = intval($_POST['auto_queue_worker_sleep']);
- set_config('queueworker', 'auto_queue_worker_sleep', $auto_queue_worker_sleep);
+ Config::Set('queueworker', 'auto_queue_worker_sleep', $auto_queue_worker_sleep);
goaway(z_root() . '/admin/queueworker');
}
@@ -54,7 +55,7 @@ class Queueworker extends Controller {
}
}
- $maxqueueworkers = get_config('queueworker', 'max_queueworkers', 4);
+ $maxqueueworkers = Config::Get('queueworker', 'max_queueworkers', 4);
$maxqueueworkers = ($maxqueueworkers > 3) ? $maxqueueworkers : 4;
$sc = '';
@@ -68,7 +69,7 @@ class Queueworker extends Controller {
]
]);
- $workermaxage = get_config('queueworker', 'queueworker_max_age');
+ $workermaxage = Config::Get('queueworker', 'queueworker_max_age');
$workermaxage = ($workermaxage >= 120) ? $workermaxage : 300;
$sc .= replace_macros(get_markup_template('field_input.tpl'), [
@@ -80,10 +81,10 @@ class Queueworker extends Controller {
]
]);
- $queueworkersleep = get_config('queueworker', 'queue_worker_sleep');
+ $queueworkersleep = Config::Get('queueworker', 'queue_worker_sleep');
$queueworkersleep = ($queueworkersleep > 100) ? $queueworkersleep : 100;
- $auto_queue_worker_sleep = get_config('queueworker', 'auto_queue_worker_sleep', 0);
+ $auto_queue_worker_sleep = Config::Get('queueworker', 'auto_queue_worker_sleep', 0);
$sc .= replace_macros(get_markup_template('field_input.tpl'), [
'$field' => [
diff --git a/Zotlabs/Module/Admin/Security.php b/Zotlabs/Module/Admin/Security.php
index 499572170..559097df2 100644
--- a/Zotlabs/Module/Admin/Security.php
+++ b/Zotlabs/Module/Admin/Security.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module\Admin;
+use Zotlabs\Lib\Config;
class Security {
@@ -11,53 +12,53 @@ class Security {
$allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : '');
$not_allowed_email = ((x($_POST,'not_allowed_email')) ? notags(trim($_POST['not_allowed_email'])) : '');
- set_config('system','allowed_email', $allowed_email);
- set_config('system','not_allowed_email', $not_allowed_email);
+ Config::Set('system','allowed_email', $allowed_email);
+ Config::Set('system','not_allowed_email', $not_allowed_email);
$block_public = ((x($_POST,'block_public')) ? True : False);
- set_config('system','block_public',$block_public);
+ Config::Set('system','block_public',$block_public);
$cloud_noroot = ((x($_POST,'cloud_noroot')) ? 1 : 0);
- set_config('system','cloud_disable_siteroot',1 - $cloud_noroot);
+ Config::Set('system','cloud_disable_siteroot',1 - $cloud_noroot);
$cloud_disksize = ((x($_POST,'cloud_disksize')) ? 1 : 0);
- set_config('system','cloud_report_disksize',$cloud_disksize);
+ Config::Set('system','cloud_report_disksize',$cloud_disksize);
$ws = $this->trim_array_elems(explode("\n",$_POST['whitelisted_sites']));
- set_config('system','whitelisted_sites',$ws);
+ Config::Set('system','whitelisted_sites',$ws);
$bs = $this->trim_array_elems(explode("\n",$_POST['blacklisted_sites']));
- set_config('system','blacklisted_sites',$bs);
+ Config::Set('system','blacklisted_sites',$bs);
$wc = $this->trim_array_elems(explode("\n",$_POST['whitelisted_channels']));
- set_config('system','whitelisted_channels',$wc);
+ Config::Set('system','whitelisted_channels',$wc);
$bc = $this->trim_array_elems(explode("\n",$_POST['blacklisted_channels']));
- set_config('system','blacklisted_channels',$bc);
+ Config::Set('system','blacklisted_channels',$bc);
$embed_sslonly = ((x($_POST,'embed_sslonly')) ? True : False);
- set_config('system','embed_sslonly',$embed_sslonly);
+ Config::Set('system','embed_sslonly',$embed_sslonly);
$we = $this->trim_array_elems(explode("\n",$_POST['embed_allow']));
- set_config('system','embed_allow',$we);
+ Config::Set('system','embed_allow',$we);
$be = $this->trim_array_elems(explode("\n",$_POST['embed_deny']));
- set_config('system','embed_deny',$be);
+ Config::Set('system','embed_deny',$be);
$thumbnail_security = ((x($_POST,'thumbnail_security')) ? intval($_POST['thumbnail_security']) : 0);
- set_config('system', 'thumbnail_security' , $thumbnail_security);
+ Config::Set('system', 'thumbnail_security' , $thumbnail_security);
$inline_pdf = ((x($_POST,'inline_pdf')) ? intval($_POST['inline_pdf']) : 0);
- set_config('system', 'inline_pdf' , $inline_pdf);
+ Config::Set('system', 'inline_pdf' , $inline_pdf);
$ts = ((x($_POST,'transport_security')) ? True : False);
- set_config('system','transport_security_header',$ts);
+ Config::Set('system','transport_security_header',$ts);
$cs = ((x($_POST,'content_security')) ? True : False);
- set_config('system','content_security_policy',$cs);
+ Config::Set('system','content_security_policy',$cs);
$trusted_directory_servers = $this->trim_array_elems(explode("\n", $_POST['trusted_directory_servers']));
- set_config('system', 'trusted_directory_servers', $trusted_directory_servers);
+ Config::Set('system', 'trusted_directory_servers', $trusted_directory_servers);
goaway(z_root() . '/admin/security');
}
@@ -66,31 +67,31 @@ class Security {
function get() {
- $whitesites = get_config('system','whitelisted_sites');
+ $whitesites = Config::Get('system','whitelisted_sites');
$whitesites_str = ((is_array($whitesites)) ? implode("\n",$whitesites) : '');
- $blacksites = get_config('system','blacklisted_sites');
+ $blacksites = Config::Get('system','blacklisted_sites');
$blacksites_str = ((is_array($blacksites)) ? implode("\n",$blacksites) : '');
- $whitechannels = get_config('system','whitelisted_channels');
+ $whitechannels = Config::Get('system','whitelisted_channels');
$whitechannels_str = ((is_array($whitechannels)) ? implode("\n",$whitechannels) : '');
- $blackchannels = get_config('system','blacklisted_channels');
+ $blackchannels = Config::Get('system','blacklisted_channels');
$blackchannels_str = ((is_array($blackchannels)) ? implode("\n",$blackchannels) : '');
- $whiteembeds = get_config('system','embed_allow');
+ $whiteembeds = Config::Get('system','embed_allow');
$whiteembeds_str = ((is_array($whiteembeds)) ? implode("\n",$whiteembeds) : '');
- $blackembeds = get_config('system','embed_deny');
+ $blackembeds = Config::Get('system','embed_deny');
$blackembeds_str = ((is_array($blackembeds)) ? implode("\n",$blackembeds) : '');
- $trusted_directory_servers = get_config('system', 'trusted_directory_servers');
+ $trusted_directory_servers = Config::Get('system', 'trusted_directory_servers');
$trusted_directory_servers_str = ((is_array($trusted_directory_servers)) ? implode("\n", $trusted_directory_servers) : '');
- $is_dir = (intval(get_config('system', 'directory_mode', DIRECTORY_MODE_NORMAL)) !== DIRECTORY_MODE_NORMAL);
+ $is_dir = (intval(Config::Get('system', 'directory_mode', DIRECTORY_MODE_NORMAL)) !== DIRECTORY_MODE_NORMAL);
- $embed_coop = intval(get_config('system','embed_coop'));
+ $embed_coop = intval(Config::Get('system','embed_coop'));
if((! $whiteembeds) && (! $blackembeds)) {
$embedhelp1 = t("By default, unfiltered HTML is allowed in embedded media. This is inherently insecure.");
@@ -105,22 +106,22 @@ class Security {
'$title' => t('Administration'),
'$page' => t('Security'),
'$form_security_token' => get_form_security_token('admin_security'),
- '$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently authenticated.")),
- '$cloud_noroot' => [ 'cloud_noroot', t('Provide a cloud root directory'), 1 - intval(get_config('system','cloud_disable_siteroot')), t('The cloud root directory lists all channel names which provide public files') ],
- '$cloud_disksize' => [ 'cloud_disksize', t('Show total disk space available to cloud uploads'), intval(get_config('system','cloud_report_disksize')), '' ],
- '$transport_security' => array('transport_security', t('Set "Transport Security" HTTP header'),intval(get_config('system','transport_security_header')),''),
- '$content_security' => array('content_security', t('Set "Content Security Policy" HTTP header'),intval(get_config('system','content_security_policy')),''),
- '$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")),
- '$not_allowed_email' => array('not_allowed_email', t("Not allowed email domains"), get_config('system','not_allowed_email'), t("Comma separated list of domains which are not allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains, unless allowed domains have been defined.")),
+ '$block_public' => array('block_public', t("Block public"), Config::Get('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently authenticated.")),
+ '$cloud_noroot' => [ 'cloud_noroot', t('Provide a cloud root directory'), 1 - intval(Config::Get('system','cloud_disable_siteroot')), t('The cloud root directory lists all channel names which provide public files') ],
+ '$cloud_disksize' => [ 'cloud_disksize', t('Show total disk space available to cloud uploads'), intval(Config::Get('system','cloud_report_disksize')), '' ],
+ '$transport_security' => array('transport_security', t('Set "Transport Security" HTTP header'),intval(Config::Get('system','transport_security_header')),''),
+ '$content_security' => array('content_security', t('Set "Content Security Policy" HTTP header'),intval(Config::Get('system','content_security_policy')),''),
+ '$allowed_email' => array('allowed_email', t("Allowed email domains"), Config::Get('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")),
+ '$not_allowed_email' => array('not_allowed_email', t("Not allowed email domains"), Config::Get('system','not_allowed_email'), t("Comma separated list of domains which are not allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains, unless allowed domains have been defined.")),
'$whitelisted_sites' => array('whitelisted_sites', t('Allow communications only from these sites'), $whitesites_str, t('One site per line. Leave empty to allow communication from anywhere by default')),
'$blacklisted_sites' => array('blacklisted_sites', t('Block communications from these sites'), $blacksites_str, ''),
'$whitelisted_channels' => array('whitelisted_channels', t('Allow communications only from these channels'), $whitechannels_str, t('One channel (hash) per line. Leave empty to allow from any channel by default')),
'$blacklisted_channels' => array('blacklisted_channels', t('Block communications from these channels'), $blackchannels_str, ''),
- '$embed_sslonly' => array('embed_sslonly',t('Only allow embeds from secure (SSL) websites and links.'), intval(get_config('system','embed_sslonly')),''),
+ '$embed_sslonly' => array('embed_sslonly',t('Only allow embeds from secure (SSL) websites and links.'), intval(Config::Get('system','embed_sslonly')),''),
'$embed_allow' => array('embed_allow', t('Allow unfiltered embedded HTML content only from these domains'), $whiteembeds_str, t('One site per line. By default embedded content is filtered.')),
'$embed_deny' => array('embed_deny', t('Block embedded HTML from these domains'), $blackembeds_str, ''),
- '$thumbnail_security' => [ 'thumbnail_security', t("Allow SVG thumbnails in file browser"), get_config('system','thumbnail_security',0), t("WARNING: SVG images may contain malicious code.") ],
- '$inline_pdf' => [ 'inline_pdf', t("Allow embedded (inline) PDF files"), get_config('system','inline_pdf',0), '' ],
+ '$thumbnail_security' => [ 'thumbnail_security', t("Allow SVG thumbnails in file browser"), Config::Get('system','thumbnail_security',0), t("WARNING: SVG images may contain malicious code.") ],
+ '$inline_pdf' => [ 'inline_pdf', t("Allow embedded (inline) PDF files"), Config::Get('system','inline_pdf',0), '' ],
'$trusted_directory_servers' => (($is_dir) ? ['trusted_directory_servers', t('Additional trusted directory server URLs'), $trusted_directory_servers_str, t('Accept directory flags (spam, nsfw) from those servers. One per line like https://example.tld')] : ''),
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index dae5e7c77..abc56d298 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module\Admin;
+use Zotlabs\Lib\Config;
class Site {
@@ -125,8 +126,8 @@ class Site {
//logger( print_r( $this->msgbg, true) );
//logger( print_r( $this->joo, true) );
if ($this->error === 0) {
- set_config('system', 'register_duty', $this->register_duty);
- set_config('system', 'register_duty_jso', $this->joo);
+ Config::Set('system', 'register_duty', $this->register_duty);
+ Config::Set('system', 'register_duty_jso', $this->joo);
} else {
notice('ZAR0130E,' . t('Errors') . ': ' . $this->error . EOL . $this->msgfg . EOL);
}
@@ -134,87 +135,87 @@ class Site {
}
// <-hilmar]
- set_config('system', 'feed_contacts', $feed_contacts);
- set_config('system', 'delivery_interval', $delivery_interval);
- set_config('system', 'delivery_batch_count', $delivery_batch_count);
- set_config('system', 'poll_interval', $poll_interval);
- set_config('system', 'maxloadavg', $maxloadavg);
- set_config('system', 'frontpage', $frontpage);
- set_config('system', 'sellpage', $site_sellpage);
- set_config('system', 'workflow_channel_next', $first_page);
- set_config('system', 'site_location', $site_location);
- set_config('system', 'mirror_frontpage', $mirror_frontpage);
- set_config('system', 'sitename', $sitename);
- set_config('system', 'login_on_homepage', $login_on_homepage);
- set_config('system', 'enable_context_help', $enable_context_help);
- set_config('system', 'verify_email', $verify_email);
- set_config('system', 'max_daily_registrations', $register_perday);
- set_config('system', 'register_sameip', $register_sameip);
- set_config('system', 'register_delay', $reg_delay);
- set_config('system', 'register_expire', $reg_expire);
- set_config('system', 'default_expire_days', $default_expire_days);
- set_config('system', 'active_expire_days', $active_expire_days);
- set_config('system', 'reply_address', $reply_address);
- set_config('system', 'from_email', $from_email);
- set_config('system', 'from_email_name' , $from_email_name);
- set_config('system', 'imagick_convert_path' , $imagick_path);
- set_config('system', 'default_permissions_role', $permissions_role);
- set_config('system', 'pubstream_incl',$pub_incl);
- set_config('system', 'pubstream_excl',$pub_excl);
+ Config::Set('system', 'feed_contacts', $feed_contacts);
+ Config::Set('system', 'delivery_interval', $delivery_interval);
+ Config::Set('system', 'delivery_batch_count', $delivery_batch_count);
+ Config::Set('system', 'poll_interval', $poll_interval);
+ Config::Set('system', 'maxloadavg', $maxloadavg);
+ Config::Set('system', 'frontpage', $frontpage);
+ Config::Set('system', 'sellpage', $site_sellpage);
+ Config::Set('system', 'workflow_channel_next', $first_page);
+ Config::Set('system', 'site_location', $site_location);
+ Config::Set('system', 'mirror_frontpage', $mirror_frontpage);
+ Config::Set('system', 'sitename', $sitename);
+ Config::Set('system', 'login_on_homepage', $login_on_homepage);
+ Config::Set('system', 'enable_context_help', $enable_context_help);
+ Config::Set('system', 'verify_email', $verify_email);
+ Config::Set('system', 'max_daily_registrations', $register_perday);
+ Config::Set('system', 'register_sameip', $register_sameip);
+ Config::Set('system', 'register_delay', $reg_delay);
+ Config::Set('system', 'register_expire', $reg_expire);
+ Config::Set('system', 'default_expire_days', $default_expire_days);
+ Config::Set('system', 'active_expire_days', $active_expire_days);
+ Config::Set('system', 'reply_address', $reply_address);
+ Config::Set('system', 'from_email', $from_email);
+ Config::Set('system', 'from_email_name' , $from_email_name);
+ Config::Set('system', 'imagick_convert_path' , $imagick_path);
+ Config::Set('system', 'default_permissions_role', $permissions_role);
+ Config::Set('system', 'pubstream_incl',$pub_incl);
+ Config::Set('system', 'pubstream_excl',$pub_excl);
if($directory_server)
- set_config('system','directory_server',$directory_server);
+ Config::Set('system','directory_server',$directory_server);
if ($banner == '') {
- del_config('system', 'banner');
+ Config::Delete('system', 'banner');
} else {
- set_config('system', 'banner', $banner);
+ Config::Set('system', 'banner', $banner);
}
if ($admininfo == ''){
- del_config('system', 'admininfo');
+ Config::Delete('system', 'admininfo');
} else {
require_once('include/text.php');
linkify_tags($admininfo, local_channel());
- set_config('system', 'admininfo', $admininfo);
+ Config::Set('system', 'admininfo', $admininfo);
}
- set_config('system','siteinfo',$siteinfo);
- //set_config('system', 'language', $language);
- set_config('system', 'theme', $theme);
+ Config::Set('system','siteinfo',$siteinfo);
+ //Config::Set('system', 'language', $language);
+ Config::Set('system', 'theme', $theme);
// if ( $theme_mobile === '---' ) {
- // del_config('system', 'mobile_theme');
+ // Config::Delete('system', 'mobile_theme');
// } else {
- // set_config('system', 'mobile_theme', $theme_mobile);
+ // Config::Set('system', 'mobile_theme', $theme_mobile);
// }
- // set_config('system','site_channel', $site_channel);
- set_config('system','maximagesize', $maximagesize);
-
- set_config('system','register_policy', $register_policy);
- set_config('system','register_wo_email', $register_wo_email);
- set_config('system','minimum_age', $minimum_age);
- set_config('system','auto_channel_create', $reg_autochannel);
- set_config('system', 'invitation_only', $invitation_only);
- set_config('system', 'invitation_also', $invitation_also);
- set_config('system','access_policy', $access_policy);
- set_config('system','account_abandon_days', $abandon_days);
- set_config('system','register_text', $register_text);
- set_config('system','allowed_sites', $allowed_sites);
- set_config('system','publish_all', $force_publish);
- set_config('system','disable_discover_tab', $disable_discover_tab);
- set_config('system','site_firehose', $site_firehose);
- set_config('system','open_pubstream', $open_pubstream);
- //set_config('system','force_queue_threshold', $force_queue);
-
- set_config('system','no_community_page', $no_community_page);
- set_config('system','no_utf', $no_utf);
-
- set_config('system','sse_enabled', $sse_enabled);
-
- set_config('system','verifyssl', $verifyssl);
- set_config('system','proxyuser', $proxyuser);
- set_config('system','proxy', $proxy);
- set_config('system','curl_timeout', $timeout);
+ // Config::Set('system','site_channel', $site_channel);
+ Config::Set('system','maximagesize', $maximagesize);
+
+ Config::Set('system','register_policy', $register_policy);
+ Config::Set('system','register_wo_email', $register_wo_email);
+ Config::Set('system','minimum_age', $minimum_age);
+ Config::Set('system','auto_channel_create', $reg_autochannel);
+ Config::Set('system', 'invitation_only', $invitation_only);
+ Config::Set('system', 'invitation_also', $invitation_also);
+ Config::Set('system','access_policy', $access_policy);
+ Config::Set('system','account_abandon_days', $abandon_days);
+ Config::Set('system','register_text', $register_text);
+ Config::Set('system','allowed_sites', $allowed_sites);
+ Config::Set('system','publish_all', $force_publish);
+ Config::Set('system','disable_discover_tab', $disable_discover_tab);
+ Config::Set('system','site_firehose', $site_firehose);
+ Config::Set('system','open_pubstream', $open_pubstream);
+ //Config::Set('system','force_queue_threshold', $force_queue);
+
+ Config::Set('system','no_community_page', $no_community_page);
+ Config::Set('system','no_utf', $no_utf);
+
+ Config::Set('system','sse_enabled', $sse_enabled);
+
+ Config::Set('system','verifyssl', $verifyssl);
+ Config::Set('system','proxyuser', $proxyuser);
+ Config::Set('system','proxy', $proxy);
+ Config::Set('system','curl_timeout', $timeout);
info( t('Site settings updated.') . EOL);
goaway(z_root() . '/admin/site' );
@@ -263,7 +264,7 @@ class Site {
}
$dir_choices = null;
- $dirmode = get_config('system', 'directory_mode', DIRECTORY_MODE_NORMAL);
+ $dirmode = Config::Get('system', 'directory_mode', DIRECTORY_MODE_NORMAL);
$realm = get_directory_realm();
// directory server should not be set or settable unless we are a directory client
@@ -291,14 +292,14 @@ class Site {
/* Banner */
- $banner = get_config('system', 'banner');
+ $banner = Config::Get('system', 'banner');
if($banner === false)
- $banner = get_config('system','sitename');
+ $banner = Config::Get('system','sitename');
$banner = htmlspecialchars($banner);
/* Admin Info */
- $admininfo = get_config('system', 'admininfo');
+ $admininfo = Config::Get('system', 'admininfo');
/* Register policy */
$register_choices = Array(
@@ -306,8 +307,8 @@ class Site {
REGISTER_APPROVE => t("Yes - with approval"),
REGISTER_OPEN => t("Yes")
);
- $this->register_duty = get_config('system', 'register_duty', '-:-');
- $register_perday = get_config('system','max_daily_registrations', 50);
+ $this->register_duty = Config::Get('system', 'register_duty', '-:-');
+ $register_perday = Config::Get('system','max_daily_registrations', 50);
/* Acess policy */
$access_choices = Array(
@@ -317,7 +318,7 @@ class Site {
ACCESS_TIERED => t("My site offers free accounts with optional paid upgrades")
);
- $discover_tab = get_config('system','disable_discover_tab');
+ $discover_tab = Config::Get('system','disable_discover_tab');
// $disable public streams by default
if($discover_tab === false)
@@ -326,7 +327,7 @@ class Site {
$discover_tab = (1 - $discover_tab);
$perm_roles = \Zotlabs\Access\PermissionRoles::channel_roles();
- $default_role = get_config('system', 'default_permissions_role', 'personal');
+ $default_role = Config::Get('system', 'default_permissions_role', 'personal');
if (!in_array($default_role, array_keys($perm_roles))) {
$default_role = 'personal';
@@ -334,8 +335,8 @@ class Site {
$role = array('permissions_role' , t('Default permission role for new accounts'), $default_role, t('This role will be used for the first channel created after registration.'),$perm_roles);
- $homelogin = get_config('system','login_on_homepage');
- $enable_context_help = get_config('system','enable_context_help');
+ $homelogin = Config::Get('system','login_on_homepage');
+ $enable_context_help = Config::Get('system','enable_context_help');
// for reuse reg_delay and reg_expire
$reg_rabots = array(
@@ -347,7 +348,7 @@ class Site {
'y' => t('Year(s)')
);
$regdelay_n = $regdelay_u = false;
- $regdelay = get_config('system','register_delay');
+ $regdelay = Config::Get('system','register_delay');
if ($regdelay)
list($regdelay_n, $regdelay_u) = array(substr($regdelay,0,-1),substr($regdelay,-1));
$reg_delay = replace_macros(get_markup_template('field_duration.qmc.tpl'),
@@ -369,7 +370,7 @@ class Site {
)
);
$regexpire_n = $regexpire_u = false;
- $regexpire = get_config('system','register_expire');
+ $regexpire = Config::Get('system','register_expire');
if ($regexpire)
list($regexpire_n, $regexpire_u) = array(substr($regexpire,0,-1),substr($regexpire,-1));
$reg_expire = replace_macros(get_markup_template('field_duration.qmc.tpl'),
@@ -406,38 +407,38 @@ class Site {
'$baseurl' => z_root(),
// name, label, value, help string, extra data...
- '$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
+ '$sitename' => array('sitename', t("Site name"), htmlspecialchars(Config::Get('system','sitename'), ENT_QUOTES, 'UTF-8'),''),
'$banner' => array('banner', t("Banner/Logo"), $banner, t('Unfiltered HTML/CSS/JS is allowed')),
'$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")),
- '$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")),
- '$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
- // '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
- // '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")),
- '$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),get_config('system','feed_contacts'),t('(Heavy system resource usage)')),
- '$maximagesize' => array('maximagesize', t("Maximum image size"), intval(get_config('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
- '$minimum_age' => array('minimum_age', t("Minimum age"), (x(get_config('system','minimum_age'))?get_config('system','minimum_age'):13), t("Minimum age (in years) for who may register on this site.")),
- '$access_policy' => array('access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system','access_policy'), t("This is displayed on the public server site list."), $access_choices),
+ '$siteinfo' => array('siteinfo', t('Site Information'), Config::Get('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")),
+ '$theme' => array('theme', t("System theme"), Config::Get('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
+ // '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), Config::Get('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile),
+ // '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), Config::Get('system','site_channel'), t("Site Channel")),
+ '$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),Config::Get('system','feed_contacts'),t('(Heavy system resource usage)')),
+ '$maximagesize' => array('maximagesize', t("Maximum image size"), intval(Config::Get('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
+ '$minimum_age' => array('minimum_age', t("Minimum age"), (x(Config::Get('system','minimum_age'))?Config::Get('system','minimum_age'):13), t("Minimum age (in years) for who may register on this site.")),
+ '$access_policy' => array('access_policy', t("Which best describes the types of account offered by this hub?"), Config::Get('system','access_policy'), t("This is displayed on the public server site list."), $access_choices),
// Register
// [hilmar->
'$register_text' => [
'register_text',
t("Register text"),
- htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'),
+ htmlspecialchars(Config::Get('system','register_text'), ENT_QUOTES, 'UTF-8'),
t("This text will be displayed prominently at the registration page")
],
'$register_policy' => [
'register_policy',
t("Does this site allow new member registration?"),
- get_config('system','register_policy'),
+ Config::Get('system','register_policy'),
"",
$register_choices,
],
'$register_duty' => [
'register_duty',
t('Configure the registration open days/hours'),
- get_config('system', 'register_duty', '-:-'),
+ Config::Get('system', 'register_duty', '-:-'),
t('Empty or \'-:-\' value will keep registration open 24/7 (default)') . EOL .
t('Weekdays and hours must be separated by colon \':\', From-To ranges with a dash `-` example: 1:800-1200') . EOL .
t('Weekday:Hour pairs must be separated by space \' \' example: 1:900-1700 2:900-1700') . EOL .
@@ -448,13 +449,13 @@ class Site {
'$register_perday' => [
'register_perday',
t('Max account registrations per day'),
- get_config('system', 'max_daily_registrations', 50),
+ Config::Get('system', 'max_daily_registrations', 50),
t('Unlimited if zero or no value - default 50')
],
'$register_sameip' => [
'register_sameip',
t('Max account registrations from same IP'),
- get_config('system', 'register_sameip', 3),
+ Config::Get('system', 'register_sameip', 3),
t('Unlimited if zero or no value - default 3')
],
'$reg_delay' => $reg_delay,
@@ -462,70 +463,70 @@ class Site {
'$reg_autochannel' => [
'auto_channel_create',
t("Auto channel create"),
- get_config('system','auto_channel_create', 1),
+ Config::Get('system','auto_channel_create', 1),
t("If disabled the channel will be created in a separate step during the registration process")
],
'$invitation_only' => [
'invitation_only',
t("Require invite code"),
- get_config('system', 'invitation_only', 0)
+ Config::Get('system', 'invitation_only', 0)
],
'$invitation_also' => [
'invitation_also',
t("Allow invite code"),
- get_config('system', 'invitation_also', 0)
+ Config::Get('system', 'invitation_also', 0)
],
'$verify_email' => [
'verify_email',
t("Require email address"),
- get_config('system','verify_email'),
+ Config::Get('system','verify_email'),
t("The provided email address will be verified (recommended)")
],
'$abandon_days' => [
'abandon_days',
t('Abandon account after x days'),
- get_config('system','account_abandon_days'),
+ Config::Get('system','account_abandon_days'),
t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')
],
// <-hilmar]
'$role' => $role,
- '$frontpage' => array('frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system','frontpage'), t("example: 'pubstream' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")),
- '$mirror_frontpage' => array('mirror_frontpage', t("Preserve site homepage URL"), get_config('system','mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')),
- '$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")),
- '$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory")),
+ '$frontpage' => array('frontpage', t("Site homepage to show visitors (default: login box)"), Config::Get('system','frontpage'), t("example: 'pubstream' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")),
+ '$mirror_frontpage' => array('mirror_frontpage', t("Preserve site homepage URL"), Config::Get('system','mirror_frontpage'), t('Present the site homepage in a frame at the original location instead of redirecting')),
+ '$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), Config::Get('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")),
+ '$force_publish' => array('publish_all', t("Force publish"), Config::Get('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory")),
'$disable_discover_tab' => array('disable_discover_tab', t('Enable public stream'), $discover_tab, t('Enable the public stream. Warning: this content is unmoderated')),
- '$site_firehose' => array('site_firehose', t('Site only public stream'), get_config('system','site_firehose'), t('Restrict the public stream to content originating at this site')),
- '$open_pubstream' => array('open_pubstream', t('Allow anybody on the internet to access the public streams'), get_config('system','open_pubstream',1), t('Disable to require authentication before viewing')),
- '$incl' => array('pub_incl',t('Only import Public stream posts with this text'), get_config('system','pubstream_incl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
- '$excl' => array('pub_excl',t('Do not import Public stream posts with this text'), get_config('system','pubstream_excl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
+ '$site_firehose' => array('site_firehose', t('Site only public stream'), Config::Get('system','site_firehose'), t('Restrict the public stream to content originating at this site')),
+ '$open_pubstream' => array('open_pubstream', t('Allow anybody on the internet to access the public streams'), Config::Get('system','open_pubstream',1), t('Disable to require authentication before viewing')),
+ '$incl' => array('pub_incl',t('Only import Public stream posts with this text'), Config::Get('system','pubstream_incl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
+ '$excl' => array('pub_excl',t('Do not import Public stream posts with this text'), Config::Get('system','pubstream_excl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')),
'$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")),
'$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")),
- '$reply_address' => [ 'reply_address', t('Reply-to email address for system generated email.'), get_config('system','reply_address','noreply@' . \App::get_hostname()),'' ],
- '$from_email' => [ 'from_email', t('Sender (From) email address for system generated email.'), get_config('system','from_email','Administrator@' . \App::get_hostname()),'' ],
- '$from_email_name' => [ 'from_email_name', t('Name of email sender for system generated email.'), get_config('system','from_email_name',\Zotlabs\Lib\System::get_site_name()),'' ],
-
- '$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), get_config('system','directory_server'), t("Default directory server"), $dir_choices) : null),
-
- '$sse_enabled' => array('sse_enabled', t('Enable SSE Notifications'), get_config('system', 'sse_enabled', 0), t('If disabled, traditional polling will be used. Warning: this setting might not be suited for shared hosting')),
-
- '$proxyuser' => array('proxyuser', t("Proxy user"), get_config('system','proxyuser'), ""),
- '$proxy' => array('proxy', t("Proxy URL"), get_config('system','proxy'), ""),
- '$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
- '$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
- '$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
- //'$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',3000), t("Always defer immediate delivery if queue contains more than this number of entries.")),
- '$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
- '$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
- '$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
- '$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days', 30)), t('0 for no expiration of imported content')),
- '$active_expire_days' => array('active_expire_days', t('Do not expire any posts which have comments less than this many days ago'), intval(get_config('system','active_expire_days',7)), ''),
- '$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), get_config('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
- '$first_page' => array('first_page', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Default: profiles')),
- '$location' => array('site_location', t('Optional: site location'), get_config('system','site_location',''), t('Region or country')),
+ '$reply_address' => [ 'reply_address', t('Reply-to email address for system generated email.'), Config::Get('system','reply_address','noreply@' . \App::get_hostname()),'' ],
+ '$from_email' => [ 'from_email', t('Sender (From) email address for system generated email.'), Config::Get('system','from_email','Administrator@' . \App::get_hostname()),'' ],
+ '$from_email_name' => [ 'from_email_name', t('Name of email sender for system generated email.'), Config::Get('system','from_email_name',\Zotlabs\Lib\System::get_site_name()),'' ],
+
+ '$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), Config::Get('system','directory_server'), t("Default directory server"), $dir_choices) : null),
+
+ '$sse_enabled' => array('sse_enabled', t('Enable SSE Notifications'), Config::Get('system', 'sse_enabled', 0), t('If disabled, traditional polling will be used. Warning: this setting might not be suited for shared hosting')),
+
+ '$proxyuser' => array('proxyuser', t("Proxy user"), Config::Get('system','proxyuser'), ""),
+ '$proxy' => array('proxy', t("Proxy URL"), Config::Get('system','proxy'), ""),
+ '$timeout' => array('timeout', t("Network timeout"), (x(Config::Get('system','curl_timeout'))?Config::Get('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")),
+ '$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(Config::Get('system','delivery_interval'))?Config::Get('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")),
+ '$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(Config::Get('system','delivery_batch_count'))?Config::Get('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")),
+ //'$force_queue' => array('force_queue', t("Queue Threshold"), Config::Get('system','force_queue_threshold',3000), t("Always defer immediate delivery if queue contains more than this number of entries.")),
+ '$poll_interval' => array('poll_interval', t("Poll interval"), (x(Config::Get('system','poll_interval'))?Config::Get('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")),
+ '$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), Config::Get('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")),
+ '$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(Config::Get('system','maxloadavg')) > 0)?Config::Get('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
+ '$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(Config::Get('system','default_expire_days', 30)), t('0 for no expiration of imported content')),
+ '$active_expire_days' => array('active_expire_days', t('Do not expire any posts which have comments less than this many days ago'), intval(Config::Get('system','active_expire_days',7)), ''),
+ '$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), Config::Get('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
+ '$first_page' => array('first_page', t('Page to display after creating a new channel'), Config::Get('system','workflow_channel_next','profiles'), t('Default: profiles')),
+ '$location' => array('site_location', t('Optional: site location'), Config::Get('system','site_location',''), t('Region or country')),
'$form_security_token' => get_form_security_token("admin_site"),
));
}
diff --git a/Zotlabs/Module/Admin/Themes.php b/Zotlabs/Module/Admin/Themes.php
index 7f615afa8..6793f56b1 100644
--- a/Zotlabs/Module/Admin/Themes.php
+++ b/Zotlabs/Module/Admin/Themes.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Module\Admin;
use \Michelf\MarkdownExtra;
+use Zotlabs\Lib\Config;
/**
* @brief Admin area theme settings.
@@ -37,7 +38,7 @@ class Themes {
* @return string with parsed HTML
*/
function get(){
- $allowed_themes_str = get_config('system', 'allowed_themes');
+ $allowed_themes_str = Config::Get('system', 'allowed_themes');
$allowed_themes_raw = explode(',', $allowed_themes_str);
$allowed_themes = array();
if(count($allowed_themes_raw))
@@ -100,7 +101,7 @@ class Themes {
info(sprintf('Theme %s disabled.', $theme));
}
- set_config('system', 'allowed_themes', $s);
+ Config::Set('system', 'allowed_themes', $s);
goaway(z_root() . '/admin/themes' );
}
diff --git a/Zotlabs/Module/Api.php b/Zotlabs/Module/Api.php
index 5b835ac51..8574ae1cd 100644
--- a/Zotlabs/Module/Api.php
+++ b/Zotlabs/Module/Api.php
@@ -1,6 +1,8 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
+
require_once('include/api.php');
class Api extends \Zotlabs\Web\Controller {
@@ -57,7 +59,7 @@ class Api extends \Zotlabs\Web\Controller {
$consumer = new \OAuth1Consumer($app['client_id'], $app['pw'], $app['redirect_uri']);
$verifier = md5($app['secret'] . local_channel());
- set_config('oauth', $verifier, local_channel());
+ Config::Set('oauth', $verifier, local_channel());
if($consumer->callback_url != null) {
diff --git a/Zotlabs/Module/Apps.php b/Zotlabs/Module/Apps.php
index a955d572a..a8817111e 100644
--- a/Zotlabs/Module/Apps.php
+++ b/Zotlabs/Module/Apps.php
@@ -1,7 +1,7 @@
<?php
namespace Zotlabs\Module;
-
+use \Zotlabs\Lib\Config;
use \Zotlabs\Lib as Zlib;
class Apps extends \Zotlabs\Web\Controller {
@@ -46,7 +46,7 @@ class Apps extends \Zotlabs\Web\Controller {
}
return replace_macros(get_markup_template('myapps.tpl'), array(
- '$sitename' => get_config('system','sitename'),
+ '$sitename' => Config::Get('system','sitename'),
'$cat' => $cat,
'$title' => (($available) ? t('Available Apps') : t('Installed Apps')),
'$apps' => $apps,
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 4e6811a10..f3855b7e8 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -6,6 +6,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Crypto;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\PermissionDescription;
@@ -176,7 +177,7 @@ class Channel extends Controller {
function get($update = 0, $load = false) {
- $noscript_content = get_config('system', 'noscript_content', '1');
+ $noscript_content = Config::Get('system', 'noscript_content', '1');
$category = $datequery = $datequery2 = '';
diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php
index 1c1240e29..aa2464ac2 100644
--- a/Zotlabs/Module/Cover_photo.php
+++ b/Zotlabs/Module/Cover_photo.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
/*
@@ -112,10 +113,10 @@ class Cover_photo extends \Zotlabs\Web\Controller {
if($r) {
- $max_thumb = intval(get_config('system','max_thumbnail',1600));
+ $max_thumb = intval(Config::Get('system','max_thumbnail',1600));
$iscaled = false;
if(intval($r[0]['height']) > $max_thumb || intval($r[0]['width']) > $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) && intval($r[0]['os_storage'])) {
$fname = dbunescbin($r[0]['content']);
@@ -428,7 +429,7 @@ class Cover_photo extends \Zotlabs\Web\Controller {
function cover_photo_crop_ui_head(&$a, $ph, $hash, $smallest){
- $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/Zotlabs/Module/Dircensor.php b/Zotlabs/Module/Dircensor.php
index 4ce3a81c4..7caefa37c 100644
--- a/Zotlabs/Module/Dircensor.php
+++ b/Zotlabs/Module/Dircensor.php
@@ -3,9 +3,9 @@
namespace Zotlabs\Module;
use App;
-use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzotdir;
-
+use Zotlabs\Web\Controller;
class Dircensor extends Controller {
@@ -14,7 +14,7 @@ class Dircensor extends Controller {
return;
}
- $dirmode = intval(get_config('system','directory_mode'));
+ $dirmode = intval(Config::Get('system','directory_mode'));
if(!in_array($dirmode, [DIRECTORY_MODE_PRIMARY, DIRECTORY_MODE_SECONDARY, DIRECTORY_MODE_STANDALONE])) {
return;
diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php
index 13353c108..88e2dd59b 100644
--- a/Zotlabs/Module/Directory.php
+++ b/Zotlabs/Module/Directory.php
@@ -3,9 +3,9 @@
namespace Zotlabs\Module;
use App;
-use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzotdir;
-
+use Zotlabs\Web\Controller;
require_once('include/socgraph.php');
require_once('include/bbcode.php');
@@ -73,7 +73,7 @@ class Directory extends Controller {
return;
}
- if(get_config('system','block_public_directory',false) && (! get_observer_hash())) {
+ if(Config::Get('system','block_public_directory',false) && (! get_observer_hash())) {
notice( t('Public access denied.') . EOL);
return;
}
@@ -145,7 +145,7 @@ class Directory extends Controller {
$tpl = get_markup_template('directory_header.tpl');
- $dirmode = intval(get_config('system','directory_mode'));
+ $dirmode = intval(Config::Get('system','directory_mode'));
$directory_admin = false;
@@ -165,7 +165,7 @@ class Directory extends Controller {
$url = $directory['url'] . '/dirsearch';
}
- $token = get_config('system','realm_token');
+ $token = Config::Get('system','realm_token');
logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
@@ -184,11 +184,11 @@ class Directory extends Controller {
if($url) {
- $numtags = get_config('system','directorytags');
+ $numtags = Config::Get('system','directorytags');
$kw = ((intval($numtags) > 0) ? intval($numtags) : 50);
- if(get_config('system','disable_directory_keywords'))
+ if(Config::Get('system','disable_directory_keywords'))
$kw = 0;
if (intval($safe_mode) === 0 && $directory_admin)
@@ -213,7 +213,7 @@ class Directory extends Controller {
if(! is_null($pubforums))
$query .= '&pubforums=' . intval($pubforums);
- $directory_sort_order = get_config('system','directory_sort_order');
+ $directory_sort_order = Config::Get('system','directory_sort_order');
if(! $directory_sort_order)
$directory_sort_order = 'date';
diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php
index a5c3f41c0..a90c2104a 100644
--- a/Zotlabs/Module/Dirsearch.php
+++ b/Zotlabs/Module/Dirsearch.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module;
use App;
+use Zotlabs\Lib\Config;
use Zotlabs\Web\Controller;
class Dirsearch extends Controller {
@@ -17,7 +18,7 @@ class Dirsearch extends Controller {
// logger('request: ' . print_r($_REQUEST,true));
- $dirmode = intval(get_config('system','directory_mode'));
+ $dirmode = intval(Config::Get('system','directory_mode'));
if($dirmode == DIRECTORY_MODE_NORMAL) {
$ret['message'] = t('This site is not a directory server');
@@ -26,7 +27,7 @@ class Dirsearch extends Controller {
$access_token = $_REQUEST['t'] ?? '';
- $token = get_config('system','realm_token');
+ $token = Config::Get('system','realm_token');
if($token && $access_token != $token) {
$ret['message'] = t('This directory server requires an access token');
json_return_and_die($ret);
@@ -79,7 +80,7 @@ class Dirsearch extends Controller {
$forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : 0);
- if(get_config('system','disable_directory_keywords'))
+ if(Config::Get('system','disable_directory_keywords'))
$kw = 0;
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index f08aedc95..451ddeb1f 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module;
use App;
+use Zotlabs\Lib\Config;
use Zotlabs\Web\Controller;
class Display extends Controller {
@@ -12,7 +13,7 @@ class Display extends Controller {
function get($update = 0, $load = false) {
- $noscript_content = (get_config('system', 'noscript_content', '1') && (! $update));
+ $noscript_content = (Config::Get('system', 'noscript_content', '1') && (! $update));
$module_format = 'html';
diff --git a/Zotlabs/Module/Email_validation.php b/Zotlabs/Module/Email_validation.php
index c1ba9a01a..c5799560f 100644
--- a/Zotlabs/Module/Email_validation.php
+++ b/Zotlabs/Module/Email_validation.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
class Email_validation extends \Zotlabs\Web\Controller {
@@ -12,8 +13,8 @@ class Email_validation extends \Zotlabs\Web\Controller {
// This will redirect internally on success unless the channel is auto_created
if(account_approve(trim(basename($_POST['token'])))) {
$success = true;
- if(get_config('system','auto_channel_create')) {
- $next_page = get_config('system', 'workflow_channel_next', 'profiles');
+ if(Config::Get('system','auto_channel_create')) {
+ $next_page = Config::Get('system', 'workflow_channel_next', 'profiles');
}
if($next_page) {
goaway(z_root() . '/' . $next_page);
@@ -40,9 +41,9 @@ class Email_validation extends \Zotlabs\Web\Controller {
'$submit' => t('Submit'),
'$token' => [ 'token', t('Validation token'),'','' ],
]);
-
+
return $o;
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Fhublocs.php b/Zotlabs/Module/Fhublocs.php
index a4d335a94..6cfee94f0 100644
--- a/Zotlabs/Module/Fhublocs.php
+++ b/Zotlabs/Module/Fhublocs.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
require_once('include/crypto.php');
@@ -18,7 +19,7 @@ class Fhublocs extends \Zotlabs\Web\Controller {
$o = '';
$r = q("select * from channel where channel_removed = 0");
- $sitekey = get_config('system','pubkey');
+ $sitekey = Config::Get('system','pubkey');
if($r) {
foreach($r as $rr) {
diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php
index d33136d9e..ec528fb1a 100644
--- a/Zotlabs/Module/Go.php
+++ b/Zotlabs/Module/Go.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module;
+use Zorlabs\Lib\Config;
class Go extends \Zotlabs\Web\Controller {
@@ -44,9 +45,9 @@ class Go extends \Zotlabs\Web\Controller {
'network' => t('View your personal stream (this may be empty until you add some connections)'),
];
-
- $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
- $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+
+ $site_firehose = ((intval(Config::Get('system','site_firehose',0))) ? true : false);
+ $net_firehose = ((Config::Get('system','disable_discover_tab',1)) ? false : true);
if($site_firehose || $net_firehose) {
$options['pubstream'] = t('View the public stream. Warning: this content is not moderated');
@@ -64,4 +65,4 @@ class Go extends \Zotlabs\Web\Controller {
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php
index 1dce08757..63fdee7f0 100644
--- a/Zotlabs/Module/Group.php
+++ b/Zotlabs/Module/Group.php
@@ -2,10 +2,11 @@
namespace Zotlabs\Module;
use App;
-use Zotlabs\Web\Controller;
+use Zotlabs\Lib\AccessList;
use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
-use Zotlabs\Lib\AccessList;
+use Zotlabs\Web\Controller;
class Group extends Controller {
@@ -123,7 +124,7 @@ class Group extends Controller {
// Switch to text mode interface if we have more than 'n' contacts or group members
$switchtotext = get_pconfig(local_channel(),'system','groupedit_image_limit');
if($switchtotext === false)
- $switchtotext = get_config('system','groupedit_image_limit');
+ $switchtotext = Config::Get('system','groupedit_image_limit');
if($switchtotext === false)
$switchtotext = 400;
diff --git a/Zotlabs/Module/Home.php b/Zotlabs/Module/Home.php
index 8d78960cc..691ca1af9 100644
--- a/Zotlabs/Module/Home.php
+++ b/Zotlabs/Module/Home.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Module;
use App;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
use Zotlabs\Web\Controller;
use Zotlabs\Web\HTTPSig;
@@ -20,7 +21,7 @@ class Home extends Controller {
call_hooks('home_init', $ret);
if (Libzot::is_zot_request()) {
- $key = get_config('system', 'prvkey');
+ $key = Config::Get('system', 'prvkey');
$ret = json_encode(Libzot::site_info());
$headers = ['Content-Type' => 'application/x-zot+json', 'Digest' => HTTPSig::generate_digest_header($ret)];
@@ -38,7 +39,7 @@ class Home extends Controller {
if (local_channel() && $channel && $channel['xchan_url'] && !$splash) {
$dest = $ret['startpage'] ?? '';
if (!$dest)
- $dest = get_config('system', 'startpage');
+ $dest = Config::Get('system', 'startpage');
if (!$dest)
$dest = z_root() . '/hq';
@@ -78,7 +79,7 @@ class Home extends Controller {
if ($o)
return $o;
- $frontpage = get_config('system', 'frontpage');
+ $frontpage = Config::Get('system', 'frontpage');
if ($frontpage) {
if (strpos($frontpage, 'include:') !== false) {
$file = trim(str_replace('include:', '', $frontpage));
@@ -91,7 +92,7 @@ class Home extends Controller {
}
if (strpos($frontpage, 'http') !== 0)
$frontpage = z_root() . '/' . $frontpage;
- if (intval(get_config('system', 'mirror_frontpage'))) {
+ if (intval(Config::Get('system', 'mirror_frontpage'))) {
$o = '<html><head><title>' . t('$Projectname') . '</title></head><body style="margin: 0; padding: 0; border: none;" ><iframe src="' . $frontpage . '" width="100%" height="100%" style="margin: 0; padding: 0; border: none;" ></iframe></body></html>';
echo $o;
killme();
@@ -99,11 +100,11 @@ class Home extends Controller {
goaway($frontpage);
}
- $sitename = get_config('system', 'sitename');
+ $sitename = Config::Get('system', 'sitename');
if ($sitename)
$o .= '<h1 class="home-welcome">' . sprintf(t('Welcome to %s'), $sitename) . '</h1>';
- $loginbox = get_config('system', 'login_on_homepage');
+ $loginbox = Config::Get('system', 'login_on_homepage');
if (intval($loginbox) || $loginbox === false)
$o .= login(true);
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index c8a9ac5ed..e8968c6bd 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -9,6 +9,7 @@ require_once('include/perm_upgrade.php');
use App;
use URLify;
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
use Zotlabs\Web\Controller;
@@ -168,7 +169,7 @@ class Import extends Controller {
if ($newname) {
$x = false;
- if (get_config('system', 'unicode_usernames')) {
+ if (Config::Get('system', 'unicode_usernames')) {
$x = punify(mb_strtolower($newname));
}
@@ -227,10 +228,10 @@ class Import extends Controller {
'hubloc_url_sig' => Libzot::sign(z_root(), $channel['channel_prvkey']),
'hubloc_host' => App::get_hostname(),
'hubloc_callback' => z_root() . '/zot',
- 'hubloc_sitekey' => get_config('system', 'pubkey'),
+ 'hubloc_sitekey' => Config::Get('system', 'pubkey'),
'hubloc_updated' => datetime_convert(),
'hubloc_id_url' => channel_url($channel),
- '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'))
]
);
@@ -536,7 +537,7 @@ class Import extends Controller {
$since = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), '0001-01-01 00:00');
$until = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), 'now + 1 day');
- //$poll_interval = get_config('system', 'poll_interval', 3);
+ //$poll_interval = Config::Get('system', 'poll_interval', 3);
$page = 0;
Master::Summon(['Content_importer', sprintf('%d', $page), $since, $until, $channel['channel_address'], urlencode($hz_server)]);
diff --git a/Zotlabs/Module/Invite.php b/Zotlabs/Module/Invite.php
index bb552e4c7..3e1e98f89 100644
--- a/Zotlabs/Module/Invite.php
+++ b/Zotlabs/Module/Invite.php
@@ -3,6 +3,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
use Zotlabs\Web\Controller;
/**
@@ -76,7 +77,7 @@ class Invite extends Controller {
$feedbk = '';
$isajax = is_ajax();
$eol = $isajax ? "\n" : EOL;
- $policy = intval(get_config('system','register_policy'));
+ $policy = intval(Config::Get('system','register_policy'));
if ($policy == REGISTER_CLOSED) {
notice( 'ZAI0212E,' . t('Register is closed') . ')' . EOL);
return;
@@ -85,13 +86,13 @@ class Invite extends Controller {
$flags = 0;
elseif ($policy == REGISTER_APPROVE)
$flags = ACCOUNT_PENDING;
- $flags = ($flags | intval(get_config('system','verify_email')));
+ $flags = ($flags | intval(Config::Get('system','verify_email')));
// how many max recipients in one mail submit
- $maxto = get_config('system','invitation_max_recipients', 'na');
+ $maxto = Config::Get('system','invitation_max_recipients', 'na');
If (is_site_admin()) {
// set, if admin is operator, default to 12
- if ($maxto === 'na') set_config('system','invitation_max_recipients', 12);
+ if ($maxto === 'na') Config::Set('system','invitation_max_recipients', 12);
}
$maxto = ($maxto === 'na') ? 12 : $maxto;
@@ -323,7 +324,7 @@ class Invite extends Controller {
return Apps::app_render($papp, 'module');
}
- if (! (get_config('system','invitation_also') || get_config('system','invitation_only')) ) {
+ if (! (Config::Get('system','invitation_also') || Config::Get('system','invitation_only')) ) {
$o = 'ZAI0103E,' . t('Invites not proposed by configuration') . '. ';
$o .= t('Contact the site admin');
return $o;
@@ -331,7 +332,7 @@ class Invite extends Controller {
// invitation_by_user may still not configured, the default 'na' will tell this
// if configured, 0 disables invitations by users, other numbers are how many invites a user may propagate
- $invuser = get_config('system','invitation_by_user', 'na');
+ $invuser = Config::Get('system','invitation_by_user', 'na');
// if the mortal user drives the invitation
If (! is_site_admin()) {
@@ -352,7 +353,7 @@ class Invite extends Controller {
} else {
// general deity admin invite limit infinite (theoretical)
- if ($invuser === 'na') set_config('system','invitation_by_user', 4);
+ if ($invuser === 'na') Config::Set('system','invitation_by_user', 4);
// for display only
$invuser = '∞';
}
@@ -385,11 +386,11 @@ class Invite extends Controller {
$wehave = ($r ? $r[0]['ct'] : 0);
// invites max for all users except admins
- $invmaxau = intval(get_config('system','invitations_max_users'));
+ $invmaxau = intval(Config::Get('system','invitations_max_users'));
if(! $invmaxau) {
$invmaxau = 50;
if (is_site_admin()) {
- set_config('system','invitations_max_users',intval($invmaxau));
+ Config::Set('system','invitations_max_users',intval($invmaxau));
}
}
@@ -519,7 +520,7 @@ class Invite extends Controller {
$ts = replace_macros(get_intltext_template('invite.'.$t1.'.subject.tpl'),
array(
'$projectname' => t('$Projectname'),
- '$invite_loc' => get_config('system','sitename')
+ '$invite_loc' => Config::Get('system','sitename')
)
);
@@ -569,7 +570,7 @@ class Invite extends Controller {
function calcdue($duri=false) {
// expirations, duration interval
if ($duri===false)
- $duri = get_config('system','register_expire', '2d');
+ $duri = Config::Get('system','register_expire', '2d');
if ( preg_match( '/^[0-9]{1,2}[ihdwmy]{1}$/', $duri ) ) {
$durq = substr($duri, -1);
$durn = substr($duri, 0, -1);
diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php
index 081966dba..8eb9a8c6d 100644
--- a/Zotlabs/Module/Linkinfo.php
+++ b/Zotlabs/Module/Linkinfo.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
class Linkinfo extends \Zotlabs\Web\Controller {
@@ -168,7 +169,7 @@ class Linkinfo extends \Zotlabs\Web\Controller {
/* Execute below code only if image is present in siteinfo */
$total_images = 0;
- $max_images = get_config('system','max_bookmark_images');
+ $max_images = Config::Get('system','max_bookmark_images');
if($max_images === false)
$max_images = 2;
else
diff --git a/Zotlabs/Module/Lostpass.php b/Zotlabs/Module/Lostpass.php
index a0f9018b2..9846c541e 100644
--- a/Zotlabs/Module/Lostpass.php
+++ b/Zotlabs/Module/Lostpass.php
@@ -1,7 +1,7 @@
<?php
namespace Zotlabs\Module;
-
+use Zotlabs\Lib\Config;
class Lostpass extends \Zotlabs\Web\Controller {
@@ -34,19 +34,19 @@ class Lostpass extends \Zotlabs\Web\Controller {
$email_tpl = get_intltext_template("lostpass_eml.tpl");
$message = replace_macros($email_tpl, array(
- '$sitename' => get_config('system','sitename'),
+ '$sitename' => Config::Get('system','sitename'),
'$siteurl' => z_root(),
'$username' => sprintf( t('Site Member (%s)'), $email),
'$email' => $email,
'$reset_link' => z_root() . '/lostpass?verify=' . $hash
));
- $subject = email_header_encode(sprintf( t('Password reset requested at %s'),get_config('system','sitename')), 'UTF-8');
+ $subject = email_header_encode(sprintf( t('Password reset requested at %s'),Config::Get('system','sitename')), 'UTF-8');
$res = z_mail(
[
'toEmail' => $email,
- 'messageSubject' => sprintf( t('Password reset requested at %s'), get_config('system','sitename')),
+ 'messageSubject' => sprintf( t('Password reset requested at %s'), Config::Get('system','sitename')),
'textVersion' => $message,
]
);
@@ -114,7 +114,7 @@ class Lostpass extends \Zotlabs\Web\Controller {
$res = z_mail(
[
'toEmail' => $email,
- 'messageSubject' => sprintf( t('Your password has changed at %s'), get_config('system','sitename')),
+ 'messageSubject' => sprintf( t('Your password has changed at %s'), Config::Get('system','sitename')),
'textVersion' => $message,
]
);
diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php
index 24dbe2944..48fcd9e10 100644
--- a/Zotlabs/Module/New_channel.php
+++ b/Zotlabs/Module/New_channel.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module;
use URLify;
+use Zotlabs\Lib\Config;
require_once('include/channel.php');
require_once('include/permissions.php');
@@ -20,7 +21,7 @@ class New_channel extends \Zotlabs\Web\Controller {
$x = false;
- if(get_config('system','unicode_usernames')) {
+ if(Config::Get('system','unicode_usernames')) {
$x = punify(mb_strtolower($n));
}
@@ -55,7 +56,7 @@ class New_channel extends \Zotlabs\Web\Controller {
$x = false;
- if(get_config('system','unicode_usernames')) {
+ if(Config::Get('system','unicode_usernames')) {
$x = punify(mb_strtolower($n));
}
@@ -117,7 +118,7 @@ class New_channel extends \Zotlabs\Web\Controller {
change_channel($result['channel']['channel_id']);
- $next_page = get_config('system', 'workflow_channel_next', 'profiles');
+ $next_page = Config::Get('system', 'workflow_channel_next', 'profiles');
goaway(z_root() . '/' . $next_page);
}
@@ -138,7 +139,7 @@ class New_channel extends \Zotlabs\Web\Controller {
intval($aid)
);
if($r && (! intval($r[0]['total']))) {
- $default_role = get_config('system','default_permissions_role','personal');
+ $default_role = Config::Get('system','default_permissions_role','personal');
}
$limit = account_service_class_fetch(get_account_id(),'total_identities');
@@ -163,7 +164,7 @@ class New_channel extends \Zotlabs\Web\Controller {
$nick_help = '<span id="nick_help_loading" style="display:none">' . t('Loading') . '</span><span id="nick_help_text">';
$nick_help .= t('This will be used to create a unique network address (like an email address).');
- if(! get_config('system','unicode_usernames')) {
+ if(! Config::Get('system','unicode_usernames')) {
$nick_help .= ' ' . t('Allowed characters are a-z 0-9, - and _');
}
$nick_help .= '<span>';
diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php
index dc47d213b..8c9d4d90c 100644
--- a/Zotlabs/Module/Profile_photo.php
+++ b/Zotlabs/Module/Profile_photo.php
@@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
use Zotlabs\Web\Controller;
@@ -599,7 +600,7 @@ class Profile_photo extends Controller {
function profile_photo_crop_ui_head($ph, $hash, $smallest) {
- $max_length = get_config('system', 'max_image_length');
+ $max_length = Config::Get('system', 'max_image_length');
if (!$max_length) {
$max_length = MAX_IMAGE_LENGTH;
diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php
index 15252d6e6..58e5857ed 100644
--- a/Zotlabs/Module/Profiles.php
+++ b/Zotlabs/Module/Profiles.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
class Profiles extends \Zotlabs\Web\Controller {
@@ -673,7 +674,7 @@ class Profiles extends \Zotlabs\Web\Controller {
$opt_tpl = get_markup_template("field_checkbox.tpl");
- if (get_config('system', 'publish_all')) {
+ if (Config::Get('system', 'publish_all')) {
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
}
else {
@@ -716,7 +717,7 @@ class Profiles extends \Zotlabs\Web\Controller {
//$vctmp = (($vc) ? \Sabre\VObject\Reader::read($vc) : null);
//$vcard = (($vctmp) ? get_vcard_array($vctmp,$r[0]['id']) : [] );
- $f = get_config('system','birthday_input_format');
+ $f = Config::Get('system','birthday_input_format');
if(! $f)
$f = 'ymd';
diff --git a/Zotlabs/Module/Profperm.php b/Zotlabs/Module/Profperm.php
index 900e2f981..842197415 100644
--- a/Zotlabs/Module/Profperm.php
+++ b/Zotlabs/Module/Profperm.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
require_once('include/photos.php');
@@ -8,42 +9,42 @@ require_once('include/photos.php');
class Profperm extends \Zotlabs\Web\Controller {
function init() {
-
+
if(! local_channel())
return;
-
+
$channel = \App::get_channel();
$which = $channel['channel_address'];
-
+
$profile = \App::$argv[1];
-
+
profile_load($which,$profile);
-
+
}
-
-
+
+
function get() {
-
+
if(! local_channel()) {
notice( t('Permission denied') . EOL);
return;
}
-
-
+
+
if(argc() < 2) {
notice( t('Invalid profile identifier.') . EOL );
return;
}
-
+
// Switch to text mod interface if we have more than 'n' contacts or group members
-
+
$switchtotext = get_pconfig(local_channel(),'system','groupedit_image_limit');
if($switchtotext === false)
- $switchtotext = get_config('system','groupedit_image_limit');
+ $switchtotext = Config::Get('system','groupedit_image_limit');
if($switchtotext === false)
$switchtotext = 400;
-
-
+
+
if((argc() > 2) && intval(argv(1)) && intval(argv(2))) {
$r = q("SELECT abook_id FROM abook WHERE abook_id = %d and abook_channel = %d limit 1",
intval(argv(2)),
@@ -52,8 +53,8 @@ class Profperm extends \Zotlabs\Web\Controller {
if($r)
$change = intval(argv(2));
}
-
-
+
+
if((argc() > 1) && (intval(argv(1)))) {
$r = q("SELECT * FROM profile WHERE id = %d AND uid = %d AND is_default = 0 LIMIT 1",
intval(argv(1)),
@@ -63,21 +64,21 @@ class Profperm extends \Zotlabs\Web\Controller {
notice( t('Invalid profile identifier.') . EOL );
return;
}
-
+
$profile = $r[0];
-
+
$r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d AND abook_profile = '%s'",
intval(local_channel()),
dbesc($profile['profile_guid'])
);
-
+
$ingroup = array();
if($r)
foreach($r as $member)
$ingroup[] = $member['abook_id'];
-
+
$members = $r;
-
+
if($change) {
if(in_array($change,$ingroup)) {
q("UPDATE abook SET abook_profile = '' WHERE abook_id = %d AND abook_channel = %d",
@@ -91,42 +92,42 @@ class Profperm extends \Zotlabs\Web\Controller {
intval($change),
intval(local_channel())
);
-
+
}
-
- $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
+
+ $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d AND abook_profile = '%s'",
intval(local_channel()),
dbesc($profile['profile_guid'])
);
-
+
$members = $r;
-
+
$ingroup = array();
if(count($r))
foreach($r as $member)
$ingroup[] = $member['abook_id'];
}
-
+
$o .= '<h2>' . t('Profile Visibility Editor') . '</h2>';
-
+
$o .= '<h3>' . t('Profile') . ' \'' . $profile['profile_name'] . '\'</h3>';
-
+
$o .= '<div id="prof-edit-desc">' . t('Click on a contact to add or remove.') . '</div>';
-
+
}
-
+
$o .= '<div id="prof-update-wrapper">';
if($change)
$o = '';
-
+
$o .= '<div id="prof-members-title">';
$o .= '<h3>' . t('Visible To') . '</h3>';
$o .= '</div>';
$o .= '<div id="prof-members">';
-
+
$textmode = (($switchtotext && (count($members) > $switchtotext)) ? true : false);
-
+
foreach($members as $member) {
if($member['xchan_url']) {
$member['click'] = 'profChangeMember(' . $profile['id'] . ',' . $member['abook_id'] . '); return false;';
@@ -135,14 +136,14 @@ class Profperm extends \Zotlabs\Web\Controller {
}
$o .= '</div><div id="prof-members-end"></div>';
$o .= '<hr id="prof-separator" />';
-
+
$o .= '<div id="prof-all-contcts-title">';
$o .= '<h3>' . t("All Connections") . '</h3>';
$o .= '</div>';
$o .= '<div id="prof-all-contacts">';
-
+
$r = abook_connections(local_channel());
-
+
if($r) {
$textmode = (($switchtotext && (count($r) > $switchtotext)) ? true : false);
foreach($r as $member) {
@@ -152,17 +153,17 @@ class Profperm extends \Zotlabs\Web\Controller {
}
}
}
-
+
$o .= '</div><div id="prof-all-contacts-end"></div>';
-
+
if($change) {
echo $o;
killme();
}
$o .= '</div>';
return $o;
-
+
}
-
-
+
+
}
diff --git a/Zotlabs/Module/Pubsites.php b/Zotlabs/Module/Pubsites.php
index 032406be4..cbaa66042 100644
--- a/Zotlabs/Module/Pubsites.php
+++ b/Zotlabs/Module/Pubsites.php
@@ -1,12 +1,13 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzotdir;
class Pubsites extends \Zotlabs\Web\Controller {
function get() {
- $dirmode = intval(get_config('system','directory_mode'));
+ $dirmode = intval(Config::Get('system','directory_mode'));
$url = '';
@@ -19,7 +20,7 @@ class Pubsites extends \Zotlabs\Web\Controller {
}
$url .= '/sites';
- $rating_enabled = get_config('system','rating_enabled');
+ $rating_enabled = Config::Get('system','rating_enabled');
$o = '<div class="generic-content-wrapper">';
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index c40751fdc..d60eb88df 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -3,6 +3,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
@@ -26,19 +27,19 @@ class Pubstream extends \Zotlabs\Web\Controller {
return login();
}
- if(! intval(get_config('system','open_pubstream',1))) {
+ if(! intval(Config::Get('system','open_pubstream',1))) {
if(! get_observer_hash()) {
return login();
}
}
- $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+ $net_firehose = ((Config::Get('system','disable_discover_tab',1)) ? false : true);
if(!$net_firehose) {
return '';
}
- $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
+ $site_firehose = ((intval(Config::Get('system','site_firehose',0))) ? true : false);
$mid = $_REQUEST['mid'] ?? '';
$identifier = 'uuid';
@@ -107,7 +108,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
nav_set_selected(t('Public Stream'));
- $maxheight = get_config('system','home_divmore_height');
+ $maxheight = Config::Get('system','home_divmore_height');
if(! $maxheight)
$maxheight = 400;
@@ -172,7 +173,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$site_firehose_sql = " and owner_xchan in (select channel_hash from channel where channel_system = 0 and channel_removed = 0) ";
}
- if(get_config('system','public_list_mode'))
+ if(Config::Get('system','public_list_mode'))
$page_mode = 'list';
else
$page_mode = 'client';
@@ -196,7 +197,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
if($update) {
- $ordering = get_config('system', 'pubstream_ordering', 'commented');
+ $ordering = Config::Get('system', 'pubstream_ordering', 'commented');
if($load) {
if($mid) {
diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php
index ac6273951..8158416bd 100644
--- a/Zotlabs/Module/Regate.php
+++ b/Zotlabs/Module/Regate.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Connect;
use Zotlabs\Daemon\Master;
@@ -58,7 +59,7 @@ class Regate extends \Zotlabs\Web\Controller {
// normally, that should never happen here
// log suitable for fail2ban also
$logmsg = 'ZAR1230S Unexpected registration verification request for '
- . get_config('system','sitename') . ' arrived from § ' . $ip . ' §';
+ . Config::Get('system','sitename') . ' arrived from § ' . $ip . ' §';
zar_log($logmsg);
goaway(z_root());
}
@@ -118,7 +119,7 @@ class Regate extends \Zotlabs\Web\Controller {
$isa = ($isa && ($isa['account_roles'] && ACCOUNT_ROLE_ADMIN));
// approve contra invite by admin
- if ($isa && get_config('system','register_policy') == REGISTER_APPROVE) {
+ if ($isa && Config::Get('system','register_policy') == REGISTER_APPROVE) {
$flags &= $flags ^ ACCOUNT_PENDING;
}
@@ -159,7 +160,7 @@ class Regate extends \Zotlabs\Web\Controller {
$nextpage = 'new_channel';
- $auto_create = get_config('system', 'auto_channel_create', 1);
+ $auto_create = Config::Get('system', 'auto_channel_create', 1);
if($auto_create) {
@@ -179,7 +180,7 @@ class Regate extends \Zotlabs\Web\Controller {
if($reonar['chan.did1'])
set_aconfig($cra['account']['account_id'], 'register', 'channel_address', $reonar['chan.did1']);
- $permissions_role = get_config('system','default_permissions_role');
+ $permissions_role = Config::Get('system','default_permissions_role');
if($permissions_role)
set_aconfig($cra['account']['account_id'], 'register', 'permissions_role', $permissions_role);
diff --git a/Zotlabs/Module/Regdir.php b/Zotlabs/Module/Regdir.php
index e49f89231..70e021715 100644
--- a/Zotlabs/Module/Regdir.php
+++ b/Zotlabs/Module/Regdir.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Zotfinger;
use Zotlabs\Web\Controller;
@@ -13,55 +14,55 @@ use Zotlabs\Web\Controller;
* We would then need a flag in the site table to indicate that they've been
* validated by the PRIMARY directory for that realm. Sites claiming to be PRIMARY
* but are not the realm PRIMARY will be marked invalid.
- *
+ *
* @param App &$a
*/
class Regdir extends Controller {
function init() {
-
+
$result = array('success' => false);
-
+
$url = $_REQUEST['url'];
$access_token = $_REQUEST['t'];
$valid = 0;
-
+
// we probably don't need the realm as we will find out in the probe.
// What we may want to do is throw an error if you're trying to register in a different realm
// so this configuration issue can be discovered.
-
+
$realm = $_REQUEST['realm'];
if(! $realm)
$realm = DIRECTORY_REALM;
-
+
if($realm === DIRECTORY_REALM) {
$valid = 1;
} else {
- $token = get_config('system','realm_token');
+ $token = Config::Get('system','realm_token');
if($token && $access_token != $token) {
$result['message'] = 'This realm requires an access token';
return;
}
$valid = 1;
}
-
- $dirmode = intval(get_config('system','directory_mode'));
-
+
+ $dirmode = intval(Config::Get('system','directory_mode'));
+
if ($dirmode == DIRECTORY_MODE_NORMAL) {
$ret['message'] = t('This site is not a directory server');
json_return_and_die($ret);
}
-
+
$m = null;
if ($url) {
$m = parse_url($url);
-
+
if ((! $m) || (! z_dns_check($m['host']))) {
$result['message'] = 'unparseable url';
json_return_and_die($result);
}
-
+
$j = Zotfinger::exec($url);
if($j) {
$result['success'] = true;
@@ -79,7 +80,7 @@ class Regdir extends Controller {
}
else {
-
+
if ($dirmode == DIRECTORY_MODE_STANDALONE) {
$r = array(array('site_url' => z_root()));
} else {
@@ -93,7 +94,7 @@ class Regdir extends Controller {
$result['directories'] = array();
foreach ($r as $rr)
$result['directories'][] = $rr['site_url'];
-
+
json_return_and_die($result);
}
}
diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php
index 5a50b4de0..428b68178 100644
--- a/Zotlabs/Module/Register.php
+++ b/Zotlabs/Module/Register.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Module;
use App;
+use Zotlabs\Lib\Config;
use Zotlabs\Web\Controller;
require_once('include/security.php');
@@ -63,7 +64,7 @@ class Register extends Controller {
$act = q("SELECT COUNT(*) AS act FROM account")[0]['act'];
$is247 = false;
$ip = $_SERVER['REMOTE_ADDR'];
- $sameip = intval(get_config('system','register_sameip', 3));
+ $sameip = intval(Config::Get('system','register_sameip', 3));
$arr = $_POST;
$invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : '');
$name = '';
@@ -73,10 +74,10 @@ class Register extends Controller {
$password2 = ((x($arr,'password2')) ? trim($arr['password2']) : '');
$register_msg = ((x($arr,'register_msg')) ? notags(trim($arr['register_msg'])) : '');
$reonar = [];
- $auto_create = get_config('system','auto_channel_create', 1);
+ $auto_create = Config::Get('system','auto_channel_create', 1);
$duty = zar_register_dutystate();
- if (!get_config('system', 'register_duty_jso')) {
+ if (!Config::Get('system', 'register_duty_jso')) {
// if not yet configured default to true
$duty = array( 'isduty' => true, 'atfrm' => '', 'nowfmt' => '');
}
@@ -107,7 +108,7 @@ class Register extends Controller {
}
}
- $email_verify = get_config('system', 'verify_email');
+ $email_verify = Config::Get('system', 'verify_email');
if ($email_verify && !$email) {
notice(t('Email address required') . EOL);
return;
@@ -180,9 +181,9 @@ class Register extends Controller {
return;
}
- $policy = get_config('system','register_policy');
- $invonly = get_config('system','invitation_only');
- $invalso = get_config('system','invitation_also');
+ $policy = Config::Get('system','register_policy');
+ $invonly = Config::Get('system','invitation_only');
+ $invalso = Config::Get('system','invitation_also');
switch($policy) {
@@ -306,11 +307,11 @@ class Register extends Controller {
if($policy == REGISTER_OPEN || $policy == REGISTER_APPROVE ) {
- $cfgdelay = get_config('system', 'register_delay', '0i');
+ $cfgdelay = Config::Get('system', 'register_delay', '0i');
$reg_delayed = calculate_adue( $cfgdelay );
$regdelay = (($reg_delayed) ? datetime_convert(date_default_timezone_get(), 'UTC', $reg_delayed['due']) : $now);
- $cfgexpire = get_config('system', 'register_expire', '3d');
+ $cfgexpire = Config::Get('system', 'register_expire', '3d');
$reg_expires = calculate_adue( $cfgexpire );
$regexpire = (($reg_expires) ? datetime_convert(date_default_timezone_get(), 'UTC', $reg_expires['due']) : datetime_convert('UTC', 'UTC', 'now + 99 years'));
@@ -323,12 +324,12 @@ class Register extends Controller {
$didx = 'e';
push_lang(($reg['lang']) ? $reg['lang'] : App::$language);
- $reonar['from'] = get_config('system', 'from_email');
+ $reonar['from'] = Config::Get('system', 'from_email');
$reonar['to'] = $email;
- $reonar['subject'] = sprintf( t('Registration confirmation for %s'), get_config('system','sitename'));
+ $reonar['subject'] = sprintf( t('Registration confirmation for %s'), Config::Get('system','sitename'));
$reonar['txttemplate']= replace_macros(get_intltext_template('register_verify_member.tpl'),
[
- '$sitename' => get_config('system','sitename'),
+ '$sitename' => Config::Get('system','sitename'),
'$siteurl' => z_root(),
'$email' => $email,
'$timeframe' => [$regdelay, $regexpire],
@@ -430,8 +431,8 @@ class Register extends Controller {
$registration_is = '';
$other_sites = '';
- if(intval(get_config('system','register_policy')) === REGISTER_CLOSED) {
- if(intval(get_config('system','directory_mode')) === DIRECTORY_MODE_STANDALONE) {
+ if(intval(Config::Get('system','register_policy')) === REGISTER_CLOSED) {
+ if(intval(Config::Get('system','directory_mode')) === DIRECTORY_MODE_STANDALONE) {
notice(t('Registration on this hub is disabled.') . EOL);
return;
}
@@ -440,24 +441,24 @@ class Register extends Controller {
return $mod->get();
}
- if(intval(get_config('system','register_policy')) == REGISTER_APPROVE) {
+ if(intval(Config::Get('system','register_policy')) == REGISTER_APPROVE) {
$registration_is = t('Registration on this hub is by approval only.');
$other_sites = '<a href="pubsites">' . t('Register at another affiliated hub in case when prefered') . '</a>';
}
$duty = zar_register_dutystate();
- if (!get_config('system', 'register_duty_jso')) {
+ if (!Config::Get('system', 'register_duty_jso')) {
// if not yet configured default to true
$duty = array( 'isduty' => true, 'atfrm' => '', 'nowfmt' => '');
}
$invitations = false;
- if(intval(get_config('system','invitation_only'))) {
+ if(intval(Config::Get('system','invitation_only'))) {
$invitations = true;
$registration_is = t('Registration on this hub is by invitation only.');
$other_sites = '<a href="pubsites">' . t('Register at another affiliated hub') . '</a>';
- } elseif (intval(get_config('system','invitation_also'))) {
+ } elseif (intval(Config::Get('system','invitation_also'))) {
$invitations = true;
}
@@ -466,7 +467,7 @@ class Register extends Controller {
$duty['atform'] = 'disabled';
// Configurable terms of service link
- $tosurl = get_config('system','tos_url');
+ $tosurl = Config::Get('system','tos_url');
if(! $tosurl)
$tosurl = z_root() . '/help/TermsOfService';
@@ -475,21 +476,21 @@ class Register extends Controller {
// Configurable whether to restrict age or not - default is based on international legal requirements
// This can be relaxed if you are on a restricted server that does not share with public servers
- if(get_config('system','no_age_restriction')) {
+ if(Config::Get('system','no_age_restriction')) {
$label_tos = sprintf( t('I accept the %s for this website'), $toslink);
}
else {
- $age = get_config('system','minimum_age');
+ $age = Config::Get('system','minimum_age');
if(!$age) {
$age = 13;
}
$label_tos = sprintf( t('I am over %s years of age and accept the %s for this website'), $age, $toslink);
}
- $enable_tos = 1 - intval(get_config('system','no_termsofservice'));
+ $enable_tos = 1 - intval(Config::Get('system','no_termsofservice'));
- $auto_create = get_config('system', 'auto_channel_create', 1);
- $email_verify = get_config('system','verify_email');
+ $auto_create = Config::Get('system', 'auto_channel_create', 1);
+ $email_verify = Config::Get('system','verify_email');
$emailval = ((x($_REQUEST,'email')) ? strip_tags(trim($_REQUEST['email'])) : "");
$email = ['email',
@@ -506,7 +507,7 @@ class Register extends Controller {
$invite_code = array('invite_code', t('Please enter your invitation code'), ((x($_REQUEST,'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : ""));
$name = array('name', t('Your name'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Real name is preferred'), '', '', $duty['atform']);
- $nickhub = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl'));
+ $nickhub = '@' . str_replace(array('http://','https://','/'), '', Config::Get('system','baseurl'));
$nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), t('Your nickname will be used to create an easy to remember channel address'), '', '', $duty['atform']);
$tos = array('tos', $label_tos, ((x($_REQUEST,'tos')) ? $_REQUEST['tos'] : ''), '', [t('No'),t('Yes')], $duty['atform']);
@@ -520,7 +521,7 @@ class Register extends Controller {
'$title' => t('Registration'),
'$reg_is' => $registration_is,
'$register_msg' => $register_msg,
- '$registertext' => bbcode(get_config('system','register_text')),
+ '$registertext' => bbcode(Config::Get('system','register_text')),
'$other_sites' => $other_sites,
'$msg' => $opal['msg'],
'$invitations' => $invitations,
@@ -551,7 +552,7 @@ class Register extends Controller {
// check against register, account
$rear = array( 'is' => false, 'rn' => 0, 'an' => 0, 'msg' => '' );
- $max_dailies = intval(get_config('system', 'max_daily_registrations', 50));
+ $max_dailies = intval(Config::Get('system', 'max_daily_registrations', 50));
if ($max_dailies) {
diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php
index 9511c0389..3753e2a5f 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -3,11 +3,12 @@
namespace Zotlabs\Module;
use App;
-use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
-use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Config;
+use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Zotfinger;
+use Zotlabs\Web\Controller;
class Search extends Controller {
@@ -18,7 +19,7 @@ class Search extends Controller {
function get($update = 0, $load = false) {
- if ((get_config('system', 'block_public')) || (get_config('system', 'block_public_search'))) {
+ if ((Config::Get('system', 'block_public')) || (Config::Get('system', 'block_public_search'))) {
if ((!local_channel()) && (!remote_channel())) {
notice(t('Public access denied.') . EOL);
return;
diff --git a/Zotlabs/Module/Service_limits.php b/Zotlabs/Module/Service_limits.php
index 2a1f78054..aa27f7a9c 100644
--- a/Zotlabs/Module/Service_limits.php
+++ b/Zotlabs/Module/Service_limits.php
@@ -1,20 +1,20 @@
<?php
namespace Zotlabs\Module; /** @file */
-
+use Zotlabs\Lib\Config;
class Service_limits extends \Zotlabs\Web\Controller {
function get() {
-
+
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
-
+
$account = \App::get_account();
if($account['account_service_class']) {
- $x = get_config('service_class',$account['account_service_class']);
+ $x = Config::Get('service_class',$account['account_service_class']);
if($x) {
$o = print_r($x,true);
return $o;
@@ -22,7 +22,7 @@ class Service_limits extends \Zotlabs\Web\Controller {
}
return t('No service class restrictions found.');
}
-
-
-
+
+
+
}
diff --git a/Zotlabs/Module/Settings/Account.php b/Zotlabs/Module/Settings/Account.php
index 85e7c793f..0266cee12 100644
--- a/Zotlabs/Module/Settings/Account.php
+++ b/Zotlabs/Module/Settings/Account.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Module\Settings;
+use Zotlabs\Lib\Config;
+
class Account {
function post() {
@@ -19,7 +21,7 @@ class Account {
if (strpos($email, '@') > 0) {
if(! validate_email($email))
$errs[] = t('Not valid email.');
- $adm = trim(get_config('system','admin_email'));
+ $adm = trim(Config::Get('system','admin_email'));
if(($adm) && (strcasecmp($email,$adm) == 0)) {
$errs[] = t('Protected email address. Cannot change to that email.');
$email = \App::$account['account_email'];
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index 1e0c2a2db..b46208879 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -7,6 +7,7 @@ use Zotlabs\Access\PermissionLimits;
use Zotlabs\Access\PermissionRoles;
use Zotlabs\Daemon\Master;
use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
require_once('include/selectors.php');
@@ -183,11 +184,11 @@ class Channel {
$subdir = ((strlen(App::get_path())) ? '<br />' . t('or') . ' ' . z_root() . '/channel/' . $nickname : '');
$webbie = $nickname . '@' . App::get_hostname();
$intl_nickname = unpunify($nickname) . '@' . unpunify(App::get_hostname());
- $disable_discover_tab = intval(get_config('system', 'disable_discover_tab', 1)) == 1;
- $site_firehose = intval(get_config('system', 'site_firehose', 0)) == 1;
+ $disable_discover_tab = intval(Config::Get('system', 'disable_discover_tab', 1)) == 1;
+ $site_firehose = intval(Config::Get('system', 'site_firehose', 0)) == 1;
$expire = $channel['channel_expire_days'];
- $sys_expire = get_config('system', 'default_expire_days');
+ $sys_expire = Config::Get('system', 'default_expire_days');
$tpl_addr = get_markup_template("settings_nick_set.tpl");
$prof_addr = replace_macros($tpl_addr, [
diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php
index ee9692014..a7fccea47 100644
--- a/Zotlabs/Module/Settings/Display.php
+++ b/Zotlabs/Module/Settings/Display.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Module\Settings;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
class Display {
@@ -85,7 +86,7 @@ class Display {
$yes_no = array(t('No'),t('Yes'));
- $default_theme = get_config('system','theme');
+ $default_theme = Config::Get('system','theme');
if(! $default_theme)
$default_theme = 'redbasic';
@@ -95,7 +96,7 @@ class Display {
$theme = (($existing_theme) ? $existing_theme : $default_theme);
- $allowed_themes_str = get_config('system','allowed_themes');
+ $allowed_themes_str = Config::Get('system','allowed_themes');
$allowed_themes_raw = explode(',',$allowed_themes_str);
$allowed_themes = array();
if(count($allowed_themes_raw))
@@ -121,7 +122,7 @@ class Display {
$unsupported = file_exists('view/theme/' . $th . '/unsupported');
$is_library = file_exists('view/theme/'. $th . '/library');
- if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
+ if (!$is_experimental or ($is_experimental && (Config::Get('experimentals','exp_themes')==1 or Config::Get('experimentals','exp_themes')===false))){
$theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f);
if (! $is_library) {
$themes[$f] = $theme_name;
diff --git a/Zotlabs/Module/Settings/Privacy.php b/Zotlabs/Module/Settings/Privacy.php
index 316b1306e..ed14fa94c 100644
--- a/Zotlabs/Module/Settings/Privacy.php
+++ b/Zotlabs/Module/Settings/Privacy.php
@@ -6,6 +6,7 @@ use App;
use Zotlabs\Access\PermissionLimits;
use Zotlabs\Access\Permissions;
use Zotlabs\Daemon\Master;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Group;
use Zotlabs\Lib\Libsync;
@@ -81,7 +82,7 @@ class Privacy {
$help_txt = t('Advise: set to "Anybody on the internet" and use privacy groups to restrict access');
$limits = PermissionLimits::Get(local_channel());
- $anon_comments = get_config('system', 'anonymous_comments', true);
+ $anon_comments = Config::Get('system', 'anonymous_comments', true);
foreach ($global_perms as $k => $perm) {
$options = [];
diff --git a/Zotlabs/Module/Setup.php b/Zotlabs/Module/Setup.php
index 83faf85dc..74b10de25 100644
--- a/Zotlabs/Module/Setup.php
+++ b/Zotlabs/Module/Setup.php
@@ -8,6 +8,7 @@ namespace Zotlabs\Module;
* @todo This setup module could need some love and improvements.
*/
+use Zotlabs\Lib\Config;
/**
* @brief Initialisation for the setup module.
@@ -760,11 +761,11 @@ class Setup extends \Zotlabs\Web\Controller {
*/
function what_next() {
// install the standard theme
- set_config('system', 'allowed_themes', 'redbasic');
+ Config::Set('system', 'allowed_themes', 'redbasic');
// if imagick converter is installed, use it
if(@is_executable('/usr/bin/convert')) {
- set_config('system','imagick_convert_path','/usr/bin/convert');
+ Config::Set('system','imagick_convert_path','/usr/bin/convert');
}
@@ -783,7 +784,7 @@ class Setup extends \Zotlabs\Web\Controller {
$x = curl_version();
if(stristr($x['ssl_version'],'openssl'))
- set_config('system','curl_ssl_ciphers','ALL:!eNULL');
+ Config::Set('system','curl_ssl_ciphers','ALL:!eNULL');
// Create a system channel
require_once ('include/channel.php');
diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php
index 18eb703a2..df6a334d8 100644
--- a/Zotlabs/Module/Siteinfo.php
+++ b/Zotlabs/Module/Siteinfo.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
class Siteinfo extends \Zotlabs\Web\Controller {
@@ -22,9 +23,9 @@ class Siteinfo extends \Zotlabs\Web\Controller {
'$sitenametxt' => t('Site Name'),
'$sitename' => \Zotlabs\Lib\System::get_site_name(),
'$headline' => t('Site Information'),
- '$site_about' => bbcode(get_config('system','siteinfo')),
+ '$site_about' => bbcode(Config::Get('system','siteinfo')),
'$admin_headline' => t('Administrator'),
- '$admin_about' => bbcode(get_config('system','admininfo')),
+ '$admin_about' => bbcode(Config::Get('system','admininfo')),
'$terms' => t('Terms of Service'),
'$prj_header' => t('Software and Project information'),
'$prj_name' => t('This site is powered by $Projectname'),
@@ -33,7 +34,7 @@ class Siteinfo extends \Zotlabs\Web\Controller {
'$additional_text' => t('Additional federated transport protocols:'),
'$additional_fed' => implode(', ', $federated),
- '$prj_version' => ((get_config('system','hidden_version_siteinfo')) ? '' : sprintf( t('Version %s'), \Zotlabs\Lib\System::get_project_version())),
+ '$prj_version' => ((Config::Get('system','hidden_version_siteinfo')) ? '' : sprintf( t('Version %s'), \Zotlabs\Lib\System::get_project_version())),
'$prj_linktxt' => t('Project homepage'),
'$prj_srctxt' => t('Developer homepage'),
'$prj_link' => \Zotlabs\Lib\System::get_project_link(),
diff --git a/Zotlabs/Module/Sse.php b/Zotlabs/Module/Sse.php
index 8b46dcafd..5baa90128 100644
--- a/Zotlabs/Module/Sse.php
+++ b/Zotlabs/Module/Sse.php
@@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Enotify;
use Zotlabs\Lib\XConfig;
@@ -22,7 +23,7 @@ class Sse extends Controller {
killme();
}
- if(! intval(get_config('system','open_pubstream',1))) {
+ if(! intval(Config::Get('system','open_pubstream',1))) {
if(! get_observer_hash()) {
killme();
}
@@ -52,7 +53,7 @@ class Sse extends Controller {
$sleep = 1000000; // microseconds
- self::$sse_enabled = get_config('system', 'sse_enabled', 0);
+ self::$sse_enabled = Config::Get('system', 'sse_enabled', 0);
if(self::$sse_enabled) {
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index 9fb295c4b..a18301a1a 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
+use Zotlabs\Lib\Config;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Enotify;
use Zotlabs\Lib\XConfig;
@@ -424,7 +425,7 @@ class Sse_bs extends Controller {
return $result;
}
- if(! intval(get_config('system','open_pubstream',1))) {
+ if(! intval(Config::Get('system','open_pubstream',1))) {
if(! get_observer_hash()) {
$result['pubs']['offset'] = -1;
return $result;
@@ -459,7 +460,7 @@ class Sse_bs extends Controller {
$uids = " AND uid IN ( " . $sys['channel_id'] . " ) ";
- $site_firehose = get_config('system', 'site_firehose', 0);
+ $site_firehose = Config::Get('system', 'site_firehose', 0);
if($site_firehose) {
$uids = " AND uid IN ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) AND item_private = 0 AND item_wall = 1 ";
}
@@ -732,7 +733,7 @@ class Sse_bs extends Controller {
if(! self::$uid && ! is_site_admin())
return $result;
- $policy = intval(get_config('system','register_policy'));
+ $policy = intval(Config::Get('system','register_policy'));
if(($policy & REGISTER_APPROVE) != REGISTER_APPROVE)
return $result;
diff --git a/Zotlabs/Module/Well_known.php b/Zotlabs/Module/Well_known.php
index 9cc31a7d3..a90397d2f 100644
--- a/Zotlabs/Module/Well_known.php
+++ b/Zotlabs/Module/Well_known.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
class Well_known extends \Zotlabs\Web\Controller {
@@ -21,7 +22,7 @@ class Well_known extends \Zotlabs\Web\Controller {
// Note: Your web server must be configured to create this variable. For example in Apache
// you'll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr().
- if(get_config('system','siteallowed_remote_host') && (! check_siteallowed($_SERVER['REMOTE_HOST']))) {
+ if(Config::Get('system','siteallowed_remote_host') && (! check_siteallowed($_SERVER['REMOTE_HOST']))) {
logger('well_known: site not allowed. ' . $_SERVER['REMOTE_HOST']);
killme();
}
diff --git a/Zotlabs/Module/Wfinger.php b/Zotlabs/Module/Wfinger.php
index 43b039530..42dcf240f 100644
--- a/Zotlabs/Module/Wfinger.php
+++ b/Zotlabs/Module/Wfinger.php
@@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Keyutils;
use Zotlabs\Lib\Libzot;
@@ -88,7 +89,7 @@ class Wfinger extends \Zotlabs\Web\Controller {
if($root_resource) {
$result['subject'] = $resource;
$result['properties'] = [
- 'https://w3id.org/security/v1#publicKeyPem' => get_config('system','pubkey')
+ 'https://w3id.org/security/v1#publicKeyPem' => Config::Get('system','pubkey')
];
$result['links'] = [
[
diff --git a/Zotlabs/Photo/PhotoDriver.php b/Zotlabs/Photo/PhotoDriver.php
index fc34f87a9..e8b42ec1b 100644
--- a/Zotlabs/Photo/PhotoDriver.php
+++ b/Zotlabs/Photo/PhotoDriver.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Photo;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Hashpath;
/**
@@ -443,7 +444,7 @@ abstract class PhotoDriver {
$p['display_path'] = $arr['display_path'] ?? '';
$p['width'] = $arr['width'] ?? $this->getWidth();
$p['height'] = $arr['height'] ?? $this->getHeight();
- $p['expires'] = $arr['expires'] ?? gmdate('Y-m-d H:i:s', time() + get_config('system', 'photo_cache_time', 86400));
+ $p['expires'] = $arr['expires'] ?? gmdate('Y-m-d H:i:s', time() + Config::Get('system', 'photo_cache_time', 86400));
$p['profile'] = $arr['profile'] ?? 0;
if(! intval($p['imgscale']))
@@ -508,7 +509,7 @@ abstract class PhotoDriver {
$arr['imgscale'] = $scale;
- if(boolval(get_config('system','photo_storage_type', 1))) {
+ if(boolval(Config::Get('system','photo_storage_type', 1))) {
$arr['os_storage'] = 1;
diff --git a/Zotlabs/Photo/PhotoGd.php b/Zotlabs/Photo/PhotoGd.php
index 6854be0ab..4a47f97ee 100644
--- a/Zotlabs/Photo/PhotoGd.php
+++ b/Zotlabs/Photo/PhotoGd.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Photo;
+use Zotlabs\Lib\Config;
+
/**
* @brief GD photo driver.
*
@@ -157,14 +159,14 @@ class PhotoGd extends PhotoDriver {
switch($this->getType()){
case 'image/png':
- $quality = get_config('system', 'png_quality');
+ $quality = Config::Get('system', 'png_quality');
if((! $quality) || ($quality > 9))
$quality = PNG_QUALITY;
\imagepng($this->image, NULL, $quality);
break;
case 'image/webp':
- $quality = get_config('system', 'webp_quality');
+ $quality = Config::Get('system', 'webp_quality');
if((! $quality) || ($quality > 100))
$quality = WEBP_QUALITY;
\imagewebp($this->image, NULL, $quality);
@@ -174,7 +176,7 @@ class PhotoGd extends PhotoDriver {
// gd can lack imagejpeg(), but we verify during installation it is available
default:
- $quality = get_config('system', 'jpeg_quality');
+ $quality = Config::Get('system', 'jpeg_quality');
if((! $quality) || ($quality > 100))
$quality = JPEG_QUALITY;
\imagejpeg($this->image, NULL, $quality);
diff --git a/Zotlabs/Photo/PhotoImagick.php b/Zotlabs/Photo/PhotoImagick.php
index 0a08d19e6..59f276480 100644
--- a/Zotlabs/Photo/PhotoImagick.php
+++ b/Zotlabs/Photo/PhotoImagick.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Photo;
+use Zotlabs\Lib\Config;
+
/**
* @brief ImageMagick photo driver.
*/
@@ -57,7 +59,7 @@ class PhotoImagick extends PhotoDriver {
switch($this->getType()) {
case 'image/png':
- $quality = get_config('system', 'png_quality');
+ $quality = Config::Get('system', 'png_quality');
if((! $quality) || ($quality > 9))
$quality = PNG_QUALITY;
/*
@@ -73,14 +75,14 @@ class PhotoImagick extends PhotoDriver {
break;
case 'image/jpeg':
- $quality = get_config('system', 'jpeg_quality');
+ $quality = Config::Get('system', 'jpeg_quality');
if((! $quality) || ($quality > 100))
$quality = JPEG_QUALITY;
$this->image->setCompressionQuality($quality);
break;
case 'image/webp':
- $quality = get_config('system', 'webp_quality');
+ $quality = Config::Get('system', 'webp_quality');
if((! $quality) || ($quality > 100))
$quality = WEBP_QUALITY;
$this->image->setCompressionQuality($quality);
diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php
index 7288c7fd7..ba0d77c39 100644
--- a/Zotlabs/Render/Comanche.php
+++ b/Zotlabs/Render/Comanche.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Render;
+use Zotlabs\Lib\Config;
+
require_once('include/security.php');
require_once('include/menu.php');
@@ -157,7 +159,7 @@ class Comanche {
* @brief Replace conditional variables with real values.
*
* Currently supported condition variables:
- * * $config.xxx.yyy - get_config with cat = xxx and k = yyy
+ * * $config.xxx.yyy - Config::Get with cat = xxx and k = yyy
* * $request - request uri for this page
* * $observer.language - viewer's preferred language (closest match)
* * $observer.address - xchan_addr or false
@@ -172,7 +174,7 @@ class Comanche {
if($v) {
$x = explode('.', $v);
if($x[0] == 'config')
- return get_config($x[1],$x[2]);
+ return Config::Get($x[1],$x[2]);
elseif($x[0] === 'request')
return $_SERVER['REQUEST_URI'];
elseif($x[0] === 'local_channel') {
@@ -208,18 +210,18 @@ class Comanche {
*
* This is extensible. The first version of variable testing supports tests of the forms:
*
- * - [if $config.system.foo ~= baz] which will check if get_config('system','foo') contains the string 'baz';
- * - [if $config.system.foo == baz] which will check if get_config('system','foo') is the string 'baz';
- * - [if $config.system.foo != baz] which will check if get_config('system','foo') is not the string 'baz';
- * - [if $config.system.foo >= 3] which will check if get_config('system','foo') is greater than or equal to 3;
- * - [if $config.system.foo > 3] which will check if get_config('system','foo') is greater than 3;
- * - [if $config.system.foo <= 3] which will check if get_config('system','foo') is less than or equal to 3;
- * - [if $config.system.foo < 3] which will check if get_config('system','foo') is less than 3;
+ * - [if $config.system.foo ~= baz] which will check if Config::Get('system','foo') contains the string 'baz';
+ * - [if $config.system.foo == baz] which will check if Config::Get('system','foo') is the string 'baz';
+ * - [if $config.system.foo != baz] which will check if Config::Get('system','foo') is not the string 'baz';
+ * - [if $config.system.foo >= 3] which will check if Config::Get('system','foo') is greater than or equal to 3;
+ * - [if $config.system.foo > 3] which will check if Config::Get('system','foo') is greater than 3;
+ * - [if $config.system.foo <= 3] which will check if Config::Get('system','foo') is less than or equal to 3;
+ * - [if $config.system.foo < 3] which will check if Config::Get('system','foo') is less than 3;
*
- * - [if $config.system.foo {} baz] which will check if 'baz' is an array element in get_config('system','foo')
- * - [if $config.system.foo {*} baz] which will check if 'baz' is an array key in get_config('system','foo')
- * - [if $config.system.foo] which will check for a return of a true condition for get_config('system','foo');
- * - [if !$config.system.foo] which will check for a return of a false condition for get_config('system','foo');
+ * - [if $config.system.foo {} baz] which will check if 'baz' is an array element in Config::Get('system','foo')
+ * - [if $config.system.foo {*} baz] which will check if 'baz' is an array key in Config::Get('system','foo')
+ * - [if $config.system.foo] which will check for a return of a true condition for Config::Get('system','foo');
+ * - [if !$config.system.foo] which will check for a return of a false condition for Config::Get('system','foo');
*
* The values 0, '', an empty array, and an unset value will all evaluate to false.
*
diff --git a/Zotlabs/Render/SmartyTemplate.php b/Zotlabs/Render/SmartyTemplate.php
index 2cb96521b..79f03637b 100644
--- a/Zotlabs/Render/SmartyTemplate.php
+++ b/Zotlabs/Render/SmartyTemplate.php
@@ -11,7 +11,7 @@ class SmartyTemplate implements TemplateEngine {
public function __construct() {
- // Cannot use get_config() here because it is called during installation when there is no DB.
+ // Cannot use Config::Get() here because it is called during installation when there is no DB.
// FIXME: this may leak private information such as system pathnames.
$basecompiledir = ((array_key_exists('smarty3_folder', App::$config['system']))
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index 912b4442d..e7f71c8c8 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -4,6 +4,7 @@ namespace Zotlabs\Storage;
use Sabre\DAV;
use App;
+use Zotlabs\Lib\Config;
/**
* @brief Provides a DAV frontend for the webbrowser.
@@ -101,7 +102,7 @@ class Browser extends DAV\Browser\Plugin {
$folder_list = attach_folder_select_list($channel_id);
- $siteroot_disabled = get_config('system', 'cloud_disable_siteroot');
+ $siteroot_disabled = Config::Get('system', 'cloud_disable_siteroot');
$is_root_folder = (($path === 'cloud/' . $nick) ? true : false);
$parent_path = '';
@@ -210,7 +211,7 @@ class Browser extends DAV\Browser\Plugin {
// types
$photo_icon = '';
- $preview_style = intval(get_config('system','thumbnail_security',0));
+ $preview_style = intval(Config::Get('system','thumbnail_security',0));
$is_creator = (($data['creator'] === get_observer_hash()) ? true : false);
@@ -474,7 +475,7 @@ class Browser extends DAV\Browser\Plugin {
$limit = engr_units_to_bytes(service_class_fetch($this->auth->owner_id, 'attach_upload_limit'));
}
- if((! $limit) && get_config('system','cloud_report_disksize')) {
+ if((! $limit) && Config::Get('system','cloud_report_disksize')) {
$limit = engr_units_to_bytes(disk_free_space('store'));
}
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index 333251f69..b62f268d3 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Storage;
use Sabre\DAV;
+use Zotlabz\Lib\Config;
use Zotlabs\Lib\Libsync;
/**
@@ -89,7 +90,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
logger('children for ' . $this->ext_path, LOGGER_DATA);
$this->log();
- if (get_config('system', 'block_public') && (! $this->auth->channel_id) && (! $this->auth->observer)) {
+ if (Config::Get('system', 'block_public') && (! $this->auth->channel_id) && (! $this->auth->observer)) {
throw new DAV\Exception\Forbidden('Permission denied.');
}
@@ -111,7 +112,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
public function getChild($name) {
logger($name, LOGGER_DATA);
- if (get_config('system', 'block_public') && (! $this->auth->channel_id) && (! $this->auth->observer)) {
+ if (Config::Get('system', 'block_public') && (! $this->auth->channel_id) && (! $this->auth->observer)) {
throw new DAV\Exception\Forbidden('Permission denied.');
}
@@ -360,7 +361,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
intval($c[0]['channel_id'])
);
- $maxfilesize = get_config('system', 'maxfilesize');
+ $maxfilesize = Config::Get('system', 'maxfilesize');
if (($maxfilesize) && ($size > $maxfilesize)) {
attach_delete($c[0]['channel_id'], $hash);
return;
@@ -776,7 +777,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
function ChannelList(&$auth) {
$ret = [];
- if (intval(get_config('system','cloud_disable_siteroot'))) {
+ if (intval(Config::Get('system','cloud_disable_siteroot'))) {
return $ret;
}
diff --git a/Zotlabs/Storage/File.php b/Zotlabs/Storage/File.php
index ff379e2e9..642dd4515 100644
--- a/Zotlabs/Storage/File.php
+++ b/Zotlabs/Storage/File.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Storage;
use Sabre\DAV;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
/**
@@ -240,7 +241,7 @@ class File extends DAV\Node implements DAV\IFile {
// There is an Exception "InsufficientStorage" or "PaymentRequired" for
// our service class from SabreDAV we could use.
- $maxfilesize = get_config('system', 'maxfilesize');
+ $maxfilesize = Config::Get('system', 'maxfilesize');
if (($maxfilesize) && ($size > $maxfilesize)) {
attach_delete($c[0]['channel_id'], $this->data['hash']);
return;
diff --git a/Zotlabs/Thumbs/Pdf.php b/Zotlabs/Thumbs/Pdf.php
index 6f9111ed3..52afc09a3 100644
--- a/Zotlabs/Thumbs/Pdf.php
+++ b/Zotlabs/Thumbs/Pdf.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Thumbs;
+use Zotlabs\Lib\Config;
class Pdf {
@@ -29,7 +30,7 @@ class Pdf {
fclose($ostream);
}
- $imagick_path = get_config('system','imagick_convert_path');
+ $imagick_path = Config::Get('system','imagick_convert_path');
if($imagick_path && @file_exists($imagick_path)) {
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmpfile . '[0]') . ' -resize ' . $width . 'x' . $height . ' ' . escapeshellarg(PROJECT_BASE . '/' . $outfile);
// logger('imagick thumbnail command: ' . $cmd);
diff --git a/Zotlabs/Thumbs/Video.php b/Zotlabs/Thumbs/Video.php
index 9df27d703..1da500370 100644
--- a/Zotlabs/Thumbs/Video.php
+++ b/Zotlabs/Thumbs/Video.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Thumbs;
+use Zotlabs\Lib\Config;
class Video {
@@ -47,7 +48,7 @@ class Video {
logger('ffmpeg not found in path. Video thumbnails may fail.');
}
- $imagick_path = get_config('system','imagick_convert_path');
+ $imagick_path = Config::Get('system','imagick_convert_path');
if($imagick_path && @file_exists($imagick_path)) {
$cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmpfile . '[0]') . ' -resize ' . $width . 'x' . $height . ' ' . escapeshellarg(PROJECT_BASE . '/' . $outfile);
// logger('imagick thumbnail command: ' . $cmd);
diff --git a/Zotlabs/Update/_1103.php b/Zotlabs/Update/_1103.php
index 3f9a9286c..a32c81fe9 100644
--- a/Zotlabs/Update/_1103.php
+++ b/Zotlabs/Update/_1103.php
@@ -2,13 +2,15 @@
namespace Zotlabs\Update;
+use Zotlabs\Lib\Config;
+
class _1103 {
function run() {
$x = curl_version();
if(stristr($x['ssl_version'],'openssl'))
- set_config('system','curl_ssl_ciphers','ALL:!eNULL');
+ Config::Set('system','curl_ssl_ciphers','ALL:!eNULL');
return UPDATE_SUCCESS;
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Update/_1226.php b/Zotlabs/Update/_1226.php
index 6e5a0e319..526fc867b 100644
--- a/Zotlabs/Update/_1226.php
+++ b/Zotlabs/Update/_1226.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Update;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
class _1226 {
@@ -17,7 +18,7 @@ class _1226 {
$r = ($r1 && $r2);
}
else {
- $r = q("ALTER TABLE `channel` ADD `channel_portable_id` char(191) NOT NULL DEFAULT '' ,
+ $r = q("ALTER TABLE `channel` ADD `channel_portable_id` char(191) NOT NULL DEFAULT '' ,
ADD INDEX `channel_portable_id` (`channel_portable_id`)");
}
@@ -52,7 +53,7 @@ class _1226 {
$rec['xchan_hash'] = $zhash;
$rec['xchan_guid_sig'] = 'sha256.' . $rec['xchan_guid_sig'];
$rec['xchan_network'] = 'zot6';
-
+
xchan_store_lowlevel($rec);
}
$x = q("select * from hubloc where hubloc_hash = '%s' and hubloc_url = '%s' limit 1",
@@ -67,7 +68,7 @@ class _1226 {
$rec['hubloc_url_sig'] = 'sha256.' . $rec['hubloc_url_sig'];
$rec['hubloc_callback'] = z_root() . '/zot';
$rec['hubloc_id_url'] = channel_url($rv);
- $rec['hubloc_site_id'] = Libzot::make_xchan_hash(z_root(),get_config('system','pubkey'));
+ $rec['hubloc_site_id'] = Libzot::make_xchan_hash(z_root(),Config::Get('system','pubkey'));
hubloc_store_lowlevel($rec);
}
}
diff --git a/Zotlabs/Update/_1236.php b/Zotlabs/Update/_1236.php
index e57338e16..b5bfdaad8 100644
--- a/Zotlabs/Update/_1236.php
+++ b/Zotlabs/Update/_1236.php
@@ -2,15 +2,16 @@
namespace Zotlabs\Update;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
class _1236 {
function run() {
-
- $r = q("SELECT channel.channel_address, channel.channel_hash, xchan.xchan_guid, channel.channel_pubkey, channel.channel_portable_id FROM channel
- LEFT JOIN xchan ON channel_hash = xchan_hash
- WHERE xchan.xchan_network = 'zot'
+
+ $r = q("SELECT channel.channel_address, channel.channel_hash, xchan.xchan_guid, channel.channel_pubkey, channel.channel_portable_id FROM channel
+ LEFT JOIN xchan ON channel_hash = xchan_hash
+ WHERE xchan.xchan_network = 'zot'
AND channel.channel_removed = 0"
);
@@ -102,7 +103,7 @@ class _1236 {
$rec['hubloc_url_sig'] = 'sha256.' . $rec['hubloc_url_sig'];
$rec['hubloc_callback'] = z_root() . '/zot';
$rec['hubloc_id_url'] = channel_url($rr);
- $rec['hubloc_site_id'] = Libzot::make_xchan_hash(z_root(),get_config('system','pubkey'));
+ $rec['hubloc_site_id'] = Libzot::make_xchan_hash(z_root(),Config::Get('system','pubkey'));
$hubloc = hubloc_store_lowlevel($rec);
}
diff --git a/Zotlabs/Update/_1242.php b/Zotlabs/Update/_1242.php
index c2c9a66d0..0a4265984 100644
--- a/Zotlabs/Update/_1242.php
+++ b/Zotlabs/Update/_1242.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Update;
+use Zotlabs\Lib\Config;
+
class _1242 {
function run() {
@@ -10,7 +12,7 @@ class _1242 {
if ($pp['v'][0] === '{') {
$a = json_decode($pp['v'], true);
if (isset($a['encrypted'])) {
- $v = crypto_unencapsulate($a, get_config('system', 'prvkey'));
+ $v = crypto_unencapsulate($a, Config::Get('system', 'prvkey'));
set_pconfig($pp['uid'], $pp['cat'], $pp['k'], obscurify($v));
}
}
@@ -18,4 +20,4 @@ class _1242 {
return UPDATE_SUCCESS;
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Update/_1243.php b/Zotlabs/Update/_1243.php
index 850cb1d6c..05845ad47 100644
--- a/Zotlabs/Update/_1243.php
+++ b/Zotlabs/Update/_1243.php
@@ -2,15 +2,17 @@
namespace Zotlabs\Update;
+use Zotlabs\Lib\Config;
+
class _1243 {
function run() {
-
- $x = get_config('system','filesystem_storage_thumbnails');
- del_config('system','filesystem_storage_thumbnails');
+
+ $x = Config::Get('system','filesystem_storage_thumbnails');
+ Config::Delete('system','filesystem_storage_thumbnails');
if ($x !== false)
- set_config('system','photo_storage_type', intval($x));
-
+ Config::Set('system','photo_storage_type', intval($x));
+
return UPDATE_SUCCESS;
}
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index 793b8cb45..7c289ff5f 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -5,6 +5,7 @@ namespace Zotlabs\Web;
use DateTime;
use DateTimeZone;
use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Crypto;
use Zotlabs\Lib\Keyutils;
use Zotlabs\Lib\Webfinger;
@@ -528,7 +529,7 @@ class HTTPSig {
// TODO: should we default to hs2019? cavage-http-signatures-12 is not very wide spread yet
- if (get_config('system', 'use_hs2019', false) && $algorithm === 'rsa-sha256') {
+ if (Config::Get('system', 'use_hs2019', false) && $algorithm === 'rsa-sha256') {
$algorithm = 'hs2019';
}
@@ -673,7 +674,7 @@ class HTTPSig {
$iv = $key = $alg = $data = null;
if (!$prvkey) {
- $prvkey = get_config('system', 'prvkey');
+ $prvkey = Config::Get('system', 'prvkey');
}
$matches = [];
diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php
index 2876fcc3c..f2604b95d 100644
--- a/Zotlabs/Web/Router.php
+++ b/Zotlabs/Web/Router.php
@@ -4,6 +4,7 @@ namespace Zotlabs\Web;
use App;
use Zotlabs\Extend\Route;
+use Zotlabs\Lib\Config;
use Exception;
/**
@@ -154,7 +155,7 @@ class Router {
// make the file read-only so letsencrypt doesn't modify it
if(strpos($_SERVER['REQUEST_URI'],'/.well-known/') === 0) {
- if(file_exists('.well-known/.htaccess') && get_config('system','fix_apache_acme',true)) {
+ if(file_exists('.well-known/.htaccess') && Config::Get('system','fix_apache_acme',true)) {
rename('.well-known/.htaccess','.well-known/.htaccess.old');
}
}
@@ -173,7 +174,7 @@ class Router {
killme();
}
- if(get_config('system','log_404',true)) {
+ if(Config::Get('system','log_404',true)) {
logger("Module {$module} not found.", LOGGER_DEBUG, LOG_WARNING);
logger('index.php: page not found: ' . $_SERVER['REQUEST_URI']
. ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: '
diff --git a/Zotlabs/Web/Session.php b/Zotlabs/Web/Session.php
index 14c054d20..ec26e6b0d 100644
--- a/Zotlabs/Web/Session.php
+++ b/Zotlabs/Web/Session.php
@@ -10,6 +10,7 @@ namespace Zotlabs\Web;
* session info.
*/
+use Zotlabs\Lib\Config;
class Session {
@@ -24,7 +25,7 @@ class Session {
ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_httponly', 1);
- $this->custom_handler = boolval(get_config('system', 'session_custom', false));
+ $this->custom_handler = boolval(Config::Get('system', 'session_custom', false));
/*
* Set our session storage functions.
@@ -33,8 +34,8 @@ class Session {
if($this->custom_handler) {
/* Custom handler (files, memached, redis..) */
- $session_save_handler = strval(get_config('system', 'session_save_handler', Null));
- $session_save_path = strval(get_config('system', 'session_save_path', Null));
+ $session_save_handler = strval(Config::Get('system', 'session_save_handler', Null));
+ $session_save_path = strval(Config::Get('system', 'session_save_path', Null));
if(is_null($session_save_handler) || is_null($session_save_path)) {
logger('Session save handler or path not set', LOGGER_NORMAL, LOG_ERR);
@@ -48,8 +49,8 @@ class Session {
else {
ini_set('session.save_handler', $session_save_handler);
ini_set('session.save_path', $session_save_path);
- ini_set('session.gc_probability', intval(get_config('system', 'session_gc_probability', 1)));
- ini_set('session.gc_divisor', intval(get_config('system', 'session_gc_divisor', 100)));
+ ini_set('session.gc_probability', intval(Config::Get('system', 'session_gc_probability', 1)));
+ ini_set('session.gc_divisor', intval(Config::Get('system', 'session_gc_divisor', 100)));
}
}
}
@@ -212,7 +213,7 @@ class Session {
$paranoia = intval(get_pconfig($_SESSION['uid'], 'system', 'paranoia'));
if(! $paranoia)
- $paranoia = intval(get_config('system', 'paranoia'));
+ $paranoia = intval(Config::Get('system', 'paranoia'));
switch($paranoia) {
case 0:
diff --git a/Zotlabs/Widget/Newmember.php b/Zotlabs/Widget/Newmember.php
index 70a858fb0..79bdf9f9f 100644
--- a/Zotlabs/Widget/Newmember.php
+++ b/Zotlabs/Widget/Newmember.php
@@ -7,6 +7,8 @@
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Config;
+
class Newmember {
function widget($arr) {
@@ -66,8 +68,8 @@ class Newmember {
]
];
- $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
- $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+ $site_firehose = ((intval(Config::Get('system','site_firehose',0))) ? true : false);
+ $net_firehose = ((Config::Get('system','disable_discover_tab',1)) ? false : true);
// hack to put this in the correct spot of the array
diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php
index 1380c156b..2ba170fe8 100644
--- a/Zotlabs/Widget/Pinned.php
+++ b/Zotlabs/Widget/Pinned.php
@@ -1,6 +1,8 @@
<?php
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Config;
+
/**
* * Name: Pinned items
* * Description: Display pinned items
@@ -31,7 +33,7 @@ class Pinned {
if(! $this->uid)
return $ret;
- $this->allowed_types = get_config('system', 'pin_types', [ ITEM_TYPE_POST ]);
+ $this->allowed_types = Config::Get('system', 'pin_types', [ ITEM_TYPE_POST ]);
$items = $this->list($types);
diff --git a/Zotlabs/Widget/Pubtagcloud.php b/Zotlabs/Widget/Pubtagcloud.php
index 90bf5eb97..8119d0c73 100644
--- a/Zotlabs/Widget/Pubtagcloud.php
+++ b/Zotlabs/Widget/Pubtagcloud.php
@@ -7,6 +7,8 @@
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Config;
+
class Pubtagcloud {
function widget($arr) {
@@ -16,19 +18,19 @@ class Pubtagcloud {
return EMPTY_STR;
}
- if(! intval(get_config('system','open_pubstream',1))) {
+ if(! intval(Config::Get('system','open_pubstream',1))) {
if(! get_observer_hash()) {
return EMPTY_STR;
}
}
- $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true);
+ $net_firehose = ((Config::Get('system','disable_discover_tab',1)) ? false : true);
if(!$net_firehose) {
return '';
}
- $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
+ $site_firehose = ((intval(Config::Get('system','site_firehose',0))) ? true : false);
$safemode = get_xconfig(get_observer_hash(),'directory','safemode',1);
diff --git a/Zotlabs/Widget/Rating.php b/Zotlabs/Widget/Rating.php
index 20c27ff1c..f8986ac93 100644
--- a/Zotlabs/Widget/Rating.php
+++ b/Zotlabs/Widget/Rating.php
@@ -8,12 +8,14 @@
namespace Zotlabs\Widget;
+use Zotlabs\Lib\Config;
+
class Rating {
function widget($arr) {
- $rating_enabled = get_config('system','rating_enabled');
+ $rating_enabled = Config::Get('system','rating_enabled');
if(! $rating_enabled) {
return;
}
diff --git a/boot.php b/boot.php
index 1dc29051e..cdfa15855 100644
--- a/boot.php
+++ b/boot.php
@@ -1249,7 +1249,7 @@ class App {
'$metas' => self::$meta->get(),
'$plugins' => $x['header'],
'$update_interval' => $interval,
- '$sse_enabled' => get_config('system', 'sse_enabled', 0),
+ '$sse_enabled' => Config::Get('system', 'sse_enabled', 0),
'$head_css' => head_get_css(),
'$head_js' => head_get_js(),
'$linkrel' => head_get_links(),
@@ -1495,9 +1495,9 @@ function is_ajax() {
*/
function check_config() {
- $saved = get_config('system', 'urlverify');
+ $saved = Config::Get('system', 'urlverify');
if (!$saved)
- set_config('system', 'urlverify', bin2hex(z_root()));
+ Config::Set('system', 'urlverify', bin2hex(z_root()));
if (($saved) && ($saved != bin2hex(z_root()))) {
// our URL changed. Do something.
@@ -1513,7 +1513,7 @@ function check_config() {
// only change the url to an ip address if it was already an ip and not a dns name
if ((!$is_ip_addr) || ($is_ip_addr && $was_ip_addr)) {
fix_system_urls($oldurl, z_root());
- set_config('system', 'urlverify', bin2hex(z_root()));
+ Config::Set('system', 'urlverify', bin2hex(z_root()));
}
else
logger('Attempt to change baseurl from a DNS name to an IP address was refused.');
@@ -1713,9 +1713,9 @@ function login($register = false, $form_id = 'main_login', $hiddens = false, $lo
// your site.
- $register_policy = get_config('system', 'register_policy');
+ $register_policy = Config::Get('system', 'register_policy');
- $reglink = get_config('system', 'register_link', z_root() . '/' . ((intval($register_policy) === REGISTER_CLOSED) ? 'pubsites' : 'register'));
+ $reglink = Config::Get('system', 'register_link', z_root() . '/' . ((intval($register_policy) === REGISTER_CLOSED) ? 'pubsites' : 'register'));
if ($reglink !== 'none') {
$reg = [
@@ -1736,7 +1736,7 @@ function login($register = false, $form_id = 'main_login', $hiddens = false, $lo
$_SESSION['login_return_url'] = App::$query_string;
}
- $email_required = get_config('system', 'verify_email');
+ $email_required = Config::Get('system', 'verify_email');
$lname_label = (($email_required) ? t('Email or nickname') : t('Nickname'));
$o .= replace_macros($tpl, [
@@ -1854,13 +1854,13 @@ function can_view_public_stream() {
return false;
}
- if (!(intval(get_config('system', 'open_pubstream', 1)))) {
+ if (!(intval(Config::Get('system', 'open_pubstream', 1)))) {
if (!get_observer_hash()) {
return false;
}
}
- $net_firehose = ((get_config('system', 'disable_discover_tab', 1)) ? false : true);
+ $net_firehose = ((Config::Get('system', 'disable_discover_tab', 1)) ? false : true);
if (!$net_firehose) {
return false;
@@ -2001,7 +2001,7 @@ function info($s) {
* @return int
*/
function get_max_import_size() {
- return (intval(get_config('system', 'max_import_size')));
+ return (intval(Config::Get('system', 'max_import_size')));
}
@@ -2055,7 +2055,7 @@ function proc_run() {
proc_close(proc_open($cmd, [], $foo));
}
else {
- if (get_config('system', 'use_proc_open'))
+ if (Config::Get('system', 'use_proc_open'))
proc_close(proc_open($cmdline . " &", [], $foo));
else
exec($cmdline . ' > /dev/null &');
@@ -2333,7 +2333,7 @@ function construct_page() {
$uid = ((App::$profile_uid) ? App::$profile_uid : local_channel());
- $navbar = get_config('system', 'navbar', 'default');
+ $navbar = Config::Get('system', 'navbar', 'default');
if ($uid) {
$navbar = get_pconfig($uid, 'system', 'navbar', $navbar);
}
@@ -2533,7 +2533,7 @@ function head_get_icon() {
* @return string
*/
function get_directory_realm() {
- if ($x = get_config('system', 'directory_realm'))
+ if ($x = Config::Get('system', 'directory_realm'))
return $x;
return DIRECTORY_REALM;
@@ -2546,13 +2546,13 @@ function get_directory_realm() {
*/
function get_directory_primary() {
- $dirmode = intval(get_config('system', 'directory_mode'));
+ $dirmode = intval(Config::Get('system', 'directory_mode'));
if ($dirmode == DIRECTORY_MODE_STANDALONE || $dirmode == DIRECTORY_MODE_PRIMARY) {
return z_root();
}
- if ($x = get_config('system', 'directory_primary'))
+ if ($x = Config::Get('system', 'directory_primary'))
return $x;
return DIRECTORY_FALLBACK_MASTER;
@@ -2565,13 +2565,13 @@ function get_directory_primary() {
* @return string relative date of last completed poller execution
*/
function get_poller_runtime() {
- $t = get_config('system', 'lastpoll');
+ $t = Config::Get('system', 'lastpoll');
return relative_date($t);
}
function z_get_upload_dir() {
- $upload_dir = get_config('system', 'uploaddir');
+ $upload_dir = Config::Get('system', 'uploaddir');
if (!$upload_dir)
$upload_dir = ini_get('upload_tmp_dir');
if (!$upload_dir)
@@ -2581,7 +2581,7 @@ function z_get_upload_dir() {
}
function z_get_temp_dir() {
- $temp_dir = get_config('system', 'tempdir');
+ $temp_dir = Config::Get('system', 'tempdir');
if (!$temp_dir)
$temp_dir = sys_get_temp_dir();
@@ -2637,12 +2637,12 @@ function check_for_new_perms() {
if (Permissions::version() != PermissionRoles::version())
return;
- $pregistered = get_config('system', 'perms');
+ $pregistered = Config::Get('system', 'perms');
$pcurrent = array_keys(Permissions::Perms());
if (!$pregistered) {
- set_config('system', 'perms', $pcurrent);
+ Config::Set('system', 'perms', $pcurrent);
return;
}
@@ -2699,7 +2699,7 @@ function check_for_new_perms() {
// We should probably call perms_refresh here, but this should get pushed in 24 hours and there is no urgency
if ($found_new_perm)
- set_config('system', 'perms', $pcurrent);
+ Config::Set('system', 'perms', $pcurrent);
}
@@ -2708,17 +2708,17 @@ function check_for_new_perms() {
*/
function check_cron_broken() {
- $d = get_config('system', 'lastcron');
+ $d = Config::Get('system', 'lastcron');
if ((!$d) || ($d < datetime_convert('UTC', 'UTC', 'now - 4 hours'))) {
Zotlabs\Daemon\Master::Summon(['Cron']);
- set_config('system', 'lastcron', datetime_convert());
+ Config::Set('system', 'lastcron', datetime_convert());
}
- $t = get_config('system', 'lastcroncheck');
+ $t = Config::Get('system', 'lastcroncheck');
if (!$t) {
// never checked before. Start the timer.
- set_config('system', 'lastcroncheck', datetime_convert());
+ Config::Set('system', 'lastcroncheck', datetime_convert());
return;
}
@@ -2727,7 +2727,7 @@ function check_cron_broken() {
return;
}
- set_config('system', 'lastcroncheck', datetime_convert());
+ Config::Set('system', 'lastcroncheck', datetime_convert());
if (($d) && ($d > datetime_convert('UTC', 'UTC', 'now - 3 days'))) {
// Scheduled tasks have run successfully in the last 3 days.
@@ -2759,7 +2759,7 @@ function check_cron_broken() {
*/
function observer_prohibited($allow_account = false) {
if ($allow_account) {
- return (((get_config('system', 'block_public')) && (!get_account_id()) && (!remote_channel())) ? true : false);
+ return (((Config::Get('system', 'block_public')) && (!get_account_id()) && (!remote_channel())) ? true : false);
}
- return (((get_config('system', 'block_public')) && (!local_channel()) && (!remote_channel())) ? true : false);
+ return (((Config::Get('system', 'block_public')) && (!local_channel()) && (!remote_channel())) ? true : false);
}
diff --git a/doc/dev-function-overview.md b/doc/dev-function-overview.md
index cd2526ead..4dccc8cef 100644
--- a/doc/dev-function-overview.md
+++ b/doc/dev-function-overview.md
@@ -21,11 +21,15 @@ returns an xchan structure representing the current viewer if authenticated (loc
* get_config($family,$key), get_pconfig($uid,$family,$key)
-Returns the config setting for $family and $key or false if unset.
+Returns the config setting for $family and $key or false if unset.
+
+Deprecated: Use Zotlabs\Lib\Config::Get instead.
* set_config($family,$key,$value), set_pconfig($uid,$family,$key,$value)
-Sets the value of config setting for $family and $key to $value. Returns $value. The config versions operate on system-wide settings. The pconfig versions get/set the values for a specific integer uid (channel_id).
+Sets the value of config setting for $family and $key to $value. Returns $value. The config versions operate on system-wide settings. The pconfig versions get/set the values for a specific integer uid (channel_id).
+
+Deprecated: Use Zotlabs\Lib\Config::Set instead.
* dbesc()
@@ -33,7 +37,7 @@ Always escape strings being used in DB queries. This function returns the escape
* q($sql,$var1...)
-Perform a DB query with the SQL statement $sql. printf style arguments %s and %d are replaced with variable arguments, which should each be appropriately dbesc() or intval(). SELECT queries return an array of results or false if SQL or DB error. Other queries return true if the command was successful or false if it wasn't.
+Perform a DB query with the SQL statement $sql. printf style arguments %s and %d are replaced with variable arguments, which should each be appropriately dbesc() or intval(). SELECT queries return an array of results or false if SQL or DB error. Other queries return true if the command was successful or false if it wasn't.
* t($string)
diff --git a/doc/developer_function_primer.bb b/doc/developer_function_primer.bb
index 48af9523d..f39954d73 100644
--- a/doc/developer_function_primer.bb
+++ b/doc/developer_function_primer.bb
@@ -20,10 +20,14 @@ returns an xchan structure representing the current viewer if authenticated (loc
Returns the config setting for $family and $key or false if unset.
+Deprecated: Use Zotlabs\Lib\Config::Get instead.
+
[b] set_config($family,$key,$value), set_pconfig($uid,$family,$key,$value)[/b]
Sets the value of config setting for $family and $key to $value. Returns $value. The config versions operate on system-wide settings. The pconfig versions get/set the values for a specific integer uid (channel_id). The xconfig version get/sets the value for a specific xchan hash - generally used for remote users.
+Deprecated: Use Zotlabs\Lib\Config::Set instead.
+
[b]dbesc()[/b]
Always escape strings being used in DB queries. This function returns the escaped string. Integer DB parameters should all be proven integers by wrapping with intval()
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']);
diff --git a/tests/unit/Photo/PhotoGdTest.php b/tests/unit/Photo/PhotoGdTest.php
index 1324043c4..7ef07864c 100644
--- a/tests/unit/Photo/PhotoGdTest.php
+++ b/tests/unit/Photo/PhotoGdTest.php
@@ -130,21 +130,8 @@ class PhotoGdTest extends UnitTestCase {
* Tests PhotoGd->imageString()
*/
public function testImagestringReturnsABinaryString() {
- // Create a stub for global function get_config()
- // get_config('system', 'png_quality')
- // get_config('system', 'jpeg_quality');
- $gc = $this->getFunctionMock('Zotlabs\Photo', 'get_config');
- $gc->expects($this->once())->willReturnCallback(
- function() {
- switch($this->photoGd->getType()){
- case 'image/png':
- return 7;
- case 'image/jpeg':
- default:
- return 70;
- }
- }
- );
+ // Init config with a known value for the test
+ \Zotlabs\Lib\Config::Set('system', 'png_quality', 7);
$this->assertIsString($this->photoGd->imageString());
}
diff --git a/tests/unit/Web/HttpSigTest.php b/tests/unit/Web/HttpSigTest.php
index 0a22b543a..c01e4f6a3 100644
--- a/tests/unit/Web/HttpSigTest.php
+++ b/tests/unit/Web/HttpSigTest.php
@@ -84,9 +84,8 @@ class HttpSigTest extends UnitTestCase {
}
function testDecrypt_sigheaderUseSitePrivateKey() {
- // Create a stub for global function get_config() with expectation
- $t = $this->getFunctionMock('Zotlabs\Web', 'get_config');
- $t->expects($this->once())->willReturn('system.prvkey');
+ // Initialize config with a known value for test
+ \Zotlabs\Lib\Config::Set('system', 'prvkey', 'system.prvkey');
$header = 'Header: iv="value_iv" key="value_key" alg="value_alg" data="value_data"';
$result = [
diff --git a/util/addons b/util/addons
index 7bd70984e..f700dfcf7 100755
--- a/util/addons
+++ b/util/addons
@@ -19,7 +19,9 @@ require_once('include/cli_startup.php');
cli_startup();
- $plugs = get_config('system', 'addon');
+use Zotlabs\Lib\Config;
+
+ $plugs = Config::Get('system', 'addon');
$plugins_arr = array();
if($plugs)
@@ -42,7 +44,7 @@ cli_startup();
if ($idz !== false) {
unset(App::$plugins[$idz]);
uninstall_plugin($id);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
}
}
$info['disabled'] = 1-intval($x);
@@ -65,7 +67,7 @@ if($argc == 2 && $argv[1] === 'list') {
echo $p[0] . "\n";
}
}
- }
+ }
killme();
}
@@ -89,7 +91,7 @@ if($argc == 3 && $argv[1] === 'list' && $argv[2] === 'all') {
foreach($plugins as $p) {
echo $p[0] . (($p[1]) ? $p[1] : (($p[2]['disabled']) ? '!' : '')) . "\n";
}
- }
+ }
killme();
}
@@ -107,12 +109,12 @@ if($argc == 3 && $argv[1] === 'install') {
else {
App::$plugins[] = $p[0];
install_plugin($p[0]);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
echo $p[0] . ' installed.' . "\n";
}
}
}
- }
+ }
killme();
}
@@ -136,12 +138,12 @@ if($argc == 3 && $argv[1] === 'uninstall') {
if ($idx !== false)
unset(App::$plugins[$idx]);
uninstall_plugin($p[0]);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
echo $p[0] . ' uninstalled.' . "\n";
}
}
}
- }
+ }
// force uninstall of addon which no longer exists
@@ -150,7 +152,7 @@ if($argc == 3 && $argv[1] === 'uninstall') {
if ($idx !== false)
unset(App::$plugins[$idx]);
uninstall_plugin($argv[2]);
- set_config("system","addon", implode(", ",App::$plugins));
+ Config::Set("system","addon", implode(", ",App::$plugins));
echo $argv[2] . ' uninstalled.' . "\n";
}
diff --git a/util/config b/util/config
index cfe4500b5..c0f51b3fb 100755
--- a/util/config
+++ b/util/config
@@ -12,13 +12,14 @@ require_once('include/cli_startup.php');
cli_startup();
+use Zotlabs\Lib\Config;
$helpArgs = getopt('h', array('help'));
if (count($helpArgs) === 1) {
echo <<<'EndOfOutput'
Gets, sets, or lists site-wide configuration settings.
-Usage: util/config
+Usage: util/config
util/config <family>
util/config <family> <key>
util/config <family> <key> <value>
@@ -36,8 +37,8 @@ Usage: util/config
Set config entry for specified family and key to value and display result
Notes:
- Setting config entries which are manually set in .htconfig.php may result
- in conflict between database settings and the manual startup settings.
+ Setting config entries which are manually set in .htconfig.php may result
+ in conflict between database settings and the manual startup settings.
For channel-specific configuration settings, use util/pconfig
@@ -55,16 +56,16 @@ if($argc > 1 && strpos($argv[1],'.')) {
}
if($argc > 3) {
- set_config($argv[1],$argv[2],$argv[3]);
- echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(get_config($argv[1],$argv[2])) . "\n";
+ Config::Set($argv[1],$argv[2],$argv[3]);
+ echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(Config::Get($argv[1],$argv[2])) . "\n";
}
if($argc == 3) {
- echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(get_config($argv[1],$argv[2])) . "\n";
+ echo "config[{$argv[1]}][{$argv[2]}] = " . printable_config(Config::Get($argv[1],$argv[2])) . "\n";
}
if($argc == 2) {
- load_config($argv[1]);
+ Config::Load($argv[1]);
foreach(App::$config[$argv[1]] as $k => $x) {
echo "config[{$argv[1]}][{$k}] = " . $x . "\n";
}
@@ -89,4 +90,4 @@ function printable_config($x) {
}
else
return $x;
-} \ No newline at end of file
+}
diff --git a/util/db_update.php b/util/db_update.php
index 8fc7c7616..d74dc6ca3 100755
--- a/util/db_update.php
+++ b/util/db_update.php
@@ -9,7 +9,9 @@ require_once('boot.php');
require_once('include/cli_startup.php');
cli_startup();
-$build = get_config('system','db_version');
+use Zotlabs\Lib\Config;
+
+$build = Config::Get('system','db_version');
echo "Old DB VERSION: " . $build . "\n";
echo "New DB VERSION: " . DB_UPDATE_VERSION . "\n";
diff --git a/util/service_class b/util/service_class
index b8a1f2386..afad4c709 100755
--- a/util/service_class
+++ b/util/service_class
@@ -7,10 +7,12 @@ require_once('include/cli_startup.php');
cli_startup();
+use Zotlabs\Lib\Config;
+
if($argc > 3) {
- $d = get_config('service_class', $argv[1]);
+ $d = Config::Get('service_class', $argv[1]);
$d[$argv[2]] = $argv[3];
- set_config('service_class', $argv[1], $d);
+ Config::Set('service_class', $argv[1], $d);
echo 'Updated service class "' . $argv[1] . '" service "' . $argv[2] . '" to ' . $argv[3] . "\n";
}
@@ -24,7 +26,7 @@ if($argc == 3) {
);
if(!$r)
die('could not find channel');
-
+
$acct = intval($r[0]['channel_account_id']);
} else {
exit();
@@ -34,28 +36,28 @@ if($argc == 3) {
);
if(!$r)
die('could not find account');
-
+
$c = q('SELECT channel_address FROM channel WHERE channel_account_id=%d',
intval($acct)
);
-
+
echo "Account $acct: ";
-
+
foreach($c as $chan)
echo $chan['channel_address'] . ', ';
-
+
echo "\n\033[1mProperty Old\t\tNew\033[0m\n";
-
+
if(empty($r[0]['account_service_class'])) {
$oclass = 'None';
$old = false;
} else {
$oclass = $r[0]['account_service_class'];
- $old = get_config('service_class', $oclass);
+ $old = Config::Get('service_class', $oclass);
}
echo "service_class $oclass\t\t\033[1m" . $argv[2] . "\033[0m\n";
-
- $new = get_config('service_class', $argv[2]);
+
+ $new = Config::Get('service_class', $argv[2]);
foreach(array('photo_upload_limit','total_items','total_pages','total_identities','total_channels','total_feeds','attach_upload_limit','minimum_feedcheck_minutes','chatrooms','chatters_inroom','access_tokens') as $prop) {
echo $prop . str_repeat(' ',26 - strlen($prop)) . (($old && $old[$prop]) ? $old[$prop] : 'unlimited') . "\t\t\033[1m" . (($new && $new[$prop]) ? $new[$prop] : 'unlimited') . "\033[0m\n";
}
@@ -67,7 +69,7 @@ if($argc == 3) {
}
if($r == 'n')
die('no update done');
-
+
$r = q("UPDATE account SET account_service_class='%s' WHERE account_id=%d",
dbesc($argv[2]),
intval($acct)
@@ -77,11 +79,11 @@ if($argc == 3) {
} else {
echo "failed\n";
}
-}
+}
if($argc == 2) {
- $d = get_config('service_class', $argv[1]);
+ $d = Config::Get('service_class', $argv[1]);
echo $argv[1] . ":\n";
foreach($d as $k => $v) {
echo "$k = $v\n";
@@ -89,7 +91,7 @@ if($argc == 2) {
}
if($argc == 1) {
- load_config('service_class');
+ Config::Load('service_class');
if(is_array(App::$config['service_class']) && App::$config['service_class']) {
foreach(App::$config['service_class'] as $class=>$props) {
echo "$class:\n";
@@ -106,4 +108,4 @@ if($argc == 1) {
}
}
}
-} \ No newline at end of file
+}
diff --git a/util/storageconv b/util/storageconv
index 676425038..fe12137a3 100755
--- a/util/storageconv
+++ b/util/storageconv
@@ -18,6 +18,7 @@ require_once('include/cli_startup.php');
cli_startup();
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Hashpath;
if($argc == 1) {
@@ -26,8 +27,8 @@ if($argc == 1) {
}
if($argc == 2) {
-
- $storage = (intval(get_config('system','photo_storage_type', 1)) > 0 ? 1 : 0);
+
+ $storage = (intval(Config::Get('system','photo_storage_type', 1)) > 0 ? 1 : 0);
echo 'Current storage set to: ' . ($storage ? 'filesystem' : 'SQL database') . PHP_EOL;
switch($argv[1]) {
case 'stats':
@@ -38,14 +39,14 @@ if($argc == 2) {
$xx = intval($x[0]['qty']);
$x = q("SELECT COUNT(resource_id) AS qty FROM photo WHERE photo_usage IN (1, 2)");
echo 'Imported profiles thumbnails: ' . $x[0]['qty'] . PHP_EOL;
- $xx += intval($x[0]['qty']);
+ $xx += intval($x[0]['qty']);
echo 'Thumbnails total: ' . $xx . PHP_EOL;
$x = q("SELECT COUNT(id) AS qty FROM photo WHERE os_storage != %d AND imgscale > 0",
$storage
);
echo 'Thumbnails to convert: ' . $x[0]['qty'] . PHP_EOL;
break;
-
+
case 'fs':
if($storage == 0) {
echo 'Please set system.photo_storage_type to 1 before move thumbnails to filesystem storage' . PHP_EOL;
@@ -101,7 +102,7 @@ if($argc == 2) {
}
echo $i . PHP_EOL . 'Total thumbnails processed: ' . $i;
break;
-
+
case 'db':
if($storage == 1) {
echo 'Please set system.photo_storage_type to 0 before move thumbnails to SQL database storage' . PHP_EOL;
@@ -119,15 +120,15 @@ if($argc == 2) {
$x = q("SELECT id, uid, resource_id, content, imgscale FROM photo WHERE id > %d AND os_storage = 1 AND imgscale > 0 ORDER BY id LIMIT 10",
intval($cur_id)
);
-
+
if($x) {
foreach($x as $xx) {
-
+
$filename = dbunescbin($xx['content']);
$content = file_get_contents($filename);
if($content) {
-
+
$z = q("UPDATE photo SET content = '%s', os_storage = 0 WHERE id = %d",
dbescbin($content),
intval($xx['id'])
@@ -136,7 +137,7 @@ if($argc == 2) {
echo PHP_EOL . 'Failed to update stored file metadata ' . $filename . PHP_EOL;
continue;
}
-
+
@unlink($filename);
}
else
@@ -152,7 +153,7 @@ if($argc == 2) {
}
echo $i . PHP_EOL . 'Total files processed: ' . $i;
break;
-
+
default:
usage();
return;
diff --git a/view/theme/redbasic/php/theme_init.php b/view/theme/redbasic/php/theme_init.php
index 54e6e7be3..cffe22de6 100644
--- a/view/theme/redbasic/php/theme_init.php
+++ b/view/theme/redbasic/php/theme_init.php
@@ -1,4 +1,6 @@
<?php
+use Zotlabs\Lib\Config;
+
require_once('view/php/theme_init.php');
head_add_css('/library/fork-awesome/css/fork-awesome.min.css');
@@ -24,8 +26,8 @@ if (App::$profile_uid) {
}
if (!$redbasic_mode) {
- $redbasic_mode = ((get_config('redbasic', 'dark_mode')) ? 'dark' : 'light');
- $redbasic_navbar_mode = ((get_config('redbasic', 'navbar_dark_mode')) ? 'dark' : 'light');
+ $redbasic_mode = ((Config::Get('redbasic', 'dark_mode')) ? 'dark' : 'light');
+ $redbasic_navbar_mode = ((Config::Get('redbasic', 'navbar_dark_mode')) ? 'dark' : 'light');
}
App::$page['color_mode'] = 'data-bs-theme="' . $redbasic_mode . '"';