From 22a6c72b317efe4d104fce2293592f22f0d3848e Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 22 Dec 2013 16:14:34 +0100 Subject: [PATCH 1/3] added option to the admin panel to allow users to set the remote_self flag --- mod/admin.php | 4 +++- view/templates/admin_site.tpl | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mod/admin.php b/mod/admin.php index dd9a0d475f..32a4ab531c 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -328,6 +328,7 @@ function admin_page_site_post(&$a){ $enotify_no_content = ((x($_POST,'enotify_no_content')) ? True : False); $private_addons = ((x($_POST,'private_addons')) ? True : False); $disable_embedded = ((x($_POST,'disable_embedded')) ? True : False); + $allow_users_remote_self = ((x($_POST,'allow_users_remote_self')) ? True : False); $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False); $no_openid = !((x($_POST,'no_openid')) ? True : False); @@ -453,6 +454,7 @@ function admin_page_site_post(&$a){ set_config('system','newuser_private', $newuser_private); set_config('system','enotify_no_content', $enotify_no_content); set_config('system','disable_embedded', $disable_embedded); + set_config('system','allow_users_remote_self', $allow_users_remote_self); set_config('system','block_extended_register', $no_multi_reg); set_config('system','no_openid', $no_openid); @@ -603,7 +605,7 @@ function admin_page_site(&$a) { '$enotify_no_content' => array('enotify_no_content', t("Don't include post content in email notifications"), get_config('system','enotify_no_content'), t("Don't include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.")), '$private_addons' => array('private_addons', t("Disallow public access to addons listed in the apps menu."), get_config('config','private_addons'), t("Checking this box will restrict addons listed in the apps menu to members only.")), '$disable_embedded' => array('disable_embedded', t("Don't embed private images in posts"), get_config('system','disable_embedded'), t("Don't replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.")), - + '$allow_users_remote_self' => array('allow_users_remote_self', t('Allow Users to set remote_self'), get_config('system','allow_users_remote_self'), t('With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream.')), '$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")), '$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")), '$no_regfullname' => array('no_regfullname', t("Fullname check"), !get_config('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")), diff --git a/view/templates/admin_site.tpl b/view/templates/admin_site.tpl index 7d0e6d8f46..6791fb87f3 100644 --- a/view/templates/admin_site.tpl +++ b/view/templates/admin_site.tpl @@ -89,6 +89,7 @@ {{include file="field_checkbox.tpl" field=$enotify_no_content}} {{include file="field_checkbox.tpl" field=$private_addons}} {{include file="field_checkbox.tpl" field=$disable_embedded}} + {{include file="field_checkbox.tpl" field=$allow_users_remote_self}}

{{$advanced}}

From f515def280ee6da2056ee496ed7fd0f9ba73e622 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 22 Dec 2013 17:05:49 +0100 Subject: [PATCH 2/3] added remote_self as option to the contact repair dislog --- mod/crepair.php | 8 ++++++-- view/templates/crepair.tpl | 9 +++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mod/crepair.php b/mod/crepair.php index ec56d7c284..1324185342 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -59,8 +59,9 @@ function crepair_post(&$a) { $poll = ((x($_POST,'poll')) ? $_POST['poll'] : ''); $attag = ((x($_POST,'attag')) ? $_POST['attag'] : ''); $photo = ((x($_POST,'photo')) ? $_POST['photo'] : ''); + $remote_self = ((x($_POST,'remote_self')) ? intval($_POST['remote_self']) : 0); - $r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s' + $r = q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `request` = '%s', `confirm` = '%s', `notify` = '%s', `poll` = '%s', `attag` = '%s', `remote_self` = '%d' WHERE `id` = %d AND `uid` = %d LIMIT 1", dbesc($name), dbesc($nick), @@ -70,6 +71,7 @@ function crepair_post(&$a) { dbesc($notify), dbesc($poll), dbesc($attag), + $remote_self, intval($contact['id']), local_user() ); @@ -154,6 +156,8 @@ function crepair_content(&$a) { '$label_notify' => t('Notification Endpoint URL'), '$label_poll' => t('Poll/Feed URL'), '$label_photo' => t('New photo from this URL'), + '$label_remote_self' => t('Remote Self'), + '$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.')), '$contact_name' => $contact['name'], '$contact_nick' => $contact['nick'], '$contact_id' => $contact['id'], @@ -164,7 +168,7 @@ function crepair_content(&$a) { '$poll' => $contact['poll'], '$contact_attag' => $contact['attag'], '$lbl_submit' => t('Submit') - )); + )); return $o; diff --git a/view/templates/crepair.tpl b/view/templates/crepair.tpl index 8d3ed7df89..27c11fa922 100644 --- a/view/templates/crepair.tpl +++ b/view/templates/crepair.tpl @@ -1,9 +1,3 @@ -{{* - * AUTOMATICALLY GENERATED TEMPLATE - * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN - * - *}} -

{{$contact_name}}

@@ -44,6 +38,9 @@
+

{{$label_remote_self}}

+{{include file="field_checkbox.tpl" field=$remote_self}} +
From 25d83f780d6112d79e54149194fecb9b44f17468 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 22 Dec 2013 19:30:09 +0100 Subject: [PATCH 3/3] only show the remote_self option if admin allows it --- mod/crepair.php | 1 + view/templates/crepair.tpl | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/crepair.php b/mod/crepair.php index 1324185342..f8336ef0ba 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -157,6 +157,7 @@ function crepair_content(&$a) { '$label_poll' => t('Poll/Feed URL'), '$label_photo' => t('New photo from this URL'), '$label_remote_self' => t('Remote Self'), + '$allow_remote_self' => get_config('system','allow_users_remote_self'), '$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.')), '$contact_name' => $contact['name'], '$contact_nick' => $contact['nick'], diff --git a/view/templates/crepair.tpl b/view/templates/crepair.tpl index 27c11fa922..d53af5dad7 100644 --- a/view/templates/crepair.tpl +++ b/view/templates/crepair.tpl @@ -37,9 +37,10 @@
- +{{if $allow_remote_self eq 1}}

{{$label_remote_self}}

{{include file="field_checkbox.tpl" field=$remote_self}} +{{/if}}