Issue 3873
[friendica-addons.git] / remote_permissions / remote_permissions.php
index 5cba005ab2848914837470239fddff1157bbaee5..a1d1a8ecf2e1c1be9a62f30513de8bf90aa23c55 100644 (file)
@@ -7,6 +7,8 @@
  * 
  */
 
+use Friendica\Core\Config;
+use Friendica\Core\PConfig;
 
 function remote_permissions_install() {
        register_hook('lockview_content', 'addon/remote_permissions/remote_permissions.php', 'remote_permissions_content');
@@ -25,7 +27,7 @@ function remote_permissions_settings(&$a,&$o) {
        if(! local_user())
                return;
 
-       $global = get_config("remote_perms", "global");
+       $global = Config::get("remote_perms", "global");
        if($global == 1)
                return;
 
@@ -35,7 +37,7 @@ function remote_permissions_settings(&$a,&$o) {
 
        /* Get the current state of our config variable */
 
-       $remote_perms = get_pconfig(local_user(),'remote_perms','show');
+       $remote_perms = PConfig::get(local_user(),'remote_perms','show');
        
        /* Add some HTML to the existing form */
 
@@ -54,7 +56,7 @@ function remote_permissions_settings_post($a,$post) {
        if(! local_user() || (! x($_POST,'remote-perms-submit')))
                return;
 
-       set_pconfig(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
+       PConfig::set(local_user(),'remote_perms','show',intval($_POST['remote-perms']));
        info( t('Remote Permissions settings updated.') . EOL);
 }
 
@@ -63,7 +65,7 @@ function remote_permissions_content($a, $item_copy) {
        if($item_copy['uid'] != local_user())
                return;
 
-       if(get_config('remote_perms','global') == 0) {
+       if(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",
@@ -86,7 +88,7 @@ function remote_permissions_content($a, $item_copy) {
                if(! $r)
                        return;
 
-               if(get_pconfig($r[0]['uid'],'remote_perms','show') == 0)
+               if(PConfig::get($r[0]['uid'],'remote_perms','show') == 0)
                        return;
        }
 
@@ -194,14 +196,14 @@ function remote_permissions_plugin_admin(&$a, &$o){
        $t = get_markup_template( "admin.tpl", "addon/remote_permissions/" );
        $o = replace_macros($t, array(
                '$submit' => t('Save Settings'),
-               '$global' => array('remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'),  get_config('remote_perms', 'global') == 1),
-               '$individual' => array('remotepermschoice', t('Individual'), 2, t('Each user chooses whether his/her posts show the post recipients'),  get_config('remote_perms', 'global') == 0)
+               '$global' => array('remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'),  Config::get('remote_perms', 'global') == 1),
+               '$individual' => array('remotepermschoice', t('Individual'), 2, t('Each user chooses whether his/her posts show the post recipients'),  Config::get('remote_perms', 'global') == 0)
        ));
 }
 
 function remote_permissions_plugin_admin_post(&$a){
        $choice =       ((x($_POST,'remotepermschoice'))                ? notags(trim($_POST['remotepermschoice']))     : '');
-       set_config('remote_perms','global',($choice == 1 ? 1 : 0));
+       Config::set('remote_perms','global',($choice == 1 ? 1 : 0));
        info( t('Settings updated.'). EOL );
 }