diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-03-24 09:58:21 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-03-24 09:58:21 +0000 |
commit | 0dc959d9fe40bddce5e99b8162bb0e770fc28ed9 (patch) | |
tree | 4ad4413b0c00d1a478111b031d9de46218f31a89 /Zotlabs/Module | |
parent | acc1834b0dc4804703610101fa95a3375649bc45 (diff) | |
download | volse-hubzilla-0dc959d9fe40bddce5e99b8162bb0e770fc28ed9.tar.gz volse-hubzilla-0dc959d9fe40bddce5e99b8162bb0e770fc28ed9.tar.bz2 volse-hubzilla-0dc959d9fe40bddce5e99b8162bb0e770fc28ed9.zip |
Deprecate *_config() functions in core.
Diffstat (limited to 'Zotlabs/Module')
50 files changed, 507 insertions, 462 deletions
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 f4f9480c0..4b9fc4cce 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'] = [ [ |