]> git.mxchange.org Git - friendica-addons.git/blobdiff - remote_permissions/remote_permissions.php
Merge pull request #948 from nupplaphil/task/di_config
[friendica-addons.git] / remote_permissions / remote_permissions.php
index 2baaa331d6a8da4d37d396e1d898d96d972b82dc..26817182819cc72101043002e7c17abd1e51cecd 100644 (file)
@@ -7,9 +7,7 @@
  * Status: Unsupported
  */
 
-use Friendica\Core\Config;
 use Friendica\Core\Hook;
-use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\DI;
@@ -32,7 +30,7 @@ function remote_permissions_settings(&$a,&$o) {
        if(! local_user())
                return;
 
-       $global = Config::get("remote_perms", "global");
+       $global = DI::config()->get("remote_perms", "global");
        if($global == 1)
                return;
 
@@ -70,7 +68,7 @@ function remote_permissions_content($a, $item_copy) {
        if($item_copy['uid'] != local_user())
                return;
 
-       if(Config::get('remote_perms','global') == 0) {
+       if(DI::config()->get('remote_perms','global') == 0) {
                // Admin has set Individual choice. We need to find
                // the original poster. First, get the contact's info
                $r = q("SELECT nick, url FROM contact WHERE id = %d LIMIT 1",
@@ -203,13 +201,13 @@ function remote_permissions_addon_admin(&$a, &$o){
        $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/remote_permissions/" );
        $o = Renderer::replaceMacros($t, [
                '$submit' => DI::l10n()->t('Save Settings'),
-               '$global' => ['remotepermschoice', DI::l10n()->t('Global'), 1, DI::l10n()->t('The posts of every user on this server show the post recipients'),  Config::get('remote_perms', 'global') == 1],
-               '$individual' => ['remotepermschoice', DI::l10n()->t('Individual'), 2, DI::l10n()->t('Each user chooses whether his/her posts show the post recipients'),  Config::get('remote_perms', 'global') == 0]
+               '$global' => ['remotepermschoice', DI::l10n()->t('Global'), 1, DI::l10n()->t('The posts of every user on this server show the post recipients'),  DI::config()->get('remote_perms', 'global') == 1],
+               '$individual' => ['remotepermschoice', DI::l10n()->t('Individual'), 2, DI::l10n()->t('Each user chooses whether his/her posts show the post recipients'),  DI::config()->get('remote_perms', 'global') == 0]
        ]);
 }
 
 function remote_permissions_addon_admin_post(&$a){
        $choice =       (!empty($_POST['remotepermschoice'])            ? Strings::escapeTags(trim($_POST['remotepermschoice']))        : '');
-       Config::set('remote_perms','global',($choice == 1 ? 1 : 0));
+       DI::config()->set('remote_perms','global',($choice == 1 ? 1 : 0));
        info(DI::l10n()->t('Settings updated.'). EOL);
 }