aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-09-22 20:38:24 -0700
committerfriendica <info@friendica.com>2013-09-22 20:38:24 -0700
commitcdfb5f9dc740734fbd95363a026ab44ae1dd9d94 (patch)
tree0b3953bb3f1d860ac728f762cd6f378b67830ba7
parentdf8035344fed17950cd129cf42bb1aab210dc334 (diff)
downloadvolse-hubzilla-cdfb5f9dc740734fbd95363a026ab44ae1dd9d94.tar.gz
volse-hubzilla-cdfb5f9dc740734fbd95363a026ab44ae1dd9d94.tar.bz2
volse-hubzilla-cdfb5f9dc740734fbd95363a026ab44ae1dd9d94.zip
adult channel setting
-rwxr-xr-xboot.php10
-rw-r--r--include/zot.php7
-rw-r--r--mod/dirsearch.php4
-rw-r--r--mod/settings.php11
-rw-r--r--mod/zfinger.php7
-rw-r--r--version.inc2
-rwxr-xr-xview/tpl/settings.tpl1
7 files changed, 28 insertions, 14 deletions
diff --git a/boot.php b/boot.php
index 76b350500..346a0f926 100755
--- a/boot.php
+++ b/boot.php
@@ -177,13 +177,7 @@ define ( 'CLIENT_MODE_UPDATE', 0x0002);
/**
*
- * page/profile types
- *
- * PAGE_NORMAL is a typical personal profile account
- * PAGE_SOAPBOX automatically approves all friend requests as CONTACT_IS_SHARING, (readonly)
- * PAGE_COMMUNITY automatically approves all friend requests as CONTACT_IS_SHARING, but with
- * write access to wall and comments (no email and not included in page owner's ACL lists)
- * PAGE_FREELOVE automatically approves all friend requests as full friends (CONTACT_IS_FRIEND).
+ * Channel pageflags
*
*/
@@ -193,6 +187,7 @@ define ( 'PAGE_AUTOCONNECT', 0x0002 );
define ( 'PAGE_APPLICATION', 0x0004 );
define ( 'PAGE_DIRECTORY_CHANNEL', 0x0008 ); // system channel used for directory synchronisation
define ( 'PAGE_PREMIUM', 0x0010 );
+define ( 'PAGE_ADULT', 0x0020 );
define ( 'PAGE_REMOVED', 0x8000 );
@@ -348,6 +343,7 @@ define ( 'HUBLOC_FLAGS_DELETED', 0x1000);
define ( 'XCHAN_FLAGS_HIDDEN', 0x0001);
define ( 'XCHAN_FLAGS_ORPHAN', 0x0002);
define ( 'XCHAN_FLAGS_CENSORED', 0x0004);
+define ( 'XCHAN_FLAGS_SELFCENSORED', 0x0008);
/*
* Traficlights for Administration of HubLoc
diff --git a/include/zot.php b/include/zot.php
index efcc4abaa..ba55880ee 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -469,6 +469,11 @@ function import_xchan($arr) {
else
$new_flags = $r[0]['xchan_flags'];
+ $adult = (($r[0]['xchan_flags'] & XCHAN_FLAGS_SELFCENSORED) ? true : false);
+ $adult_changed = ((intval($adult) != intval($arr['adult_content'])) ? true : false);
+ if($adult_changed)
+ $new_flags = $new_flags ^ XCHAN_FLAGS_SELFCENSORED;
+
if(($r[0]['xchan_name_date'] != $arr['name_updated'])
|| ($r[0]['xchan_connurl'] != $arr['connections_url'])
@@ -511,6 +516,8 @@ function import_xchan($arr) {
$new_flags = XCHAN_FLAGS_HIDDEN;
else
$new_flags = 0;
+ if($arr['adult_content'])
+ $new_flags |= XCHAN_FLAGS_SELFCENSORED;
$x = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_mimetype,
xchan_photo_l, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_photo_date, xchan_name_date, xchan_flags)
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index fc0ac4fe3..3fec691be 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -102,9 +102,9 @@ function dirsearch_content(&$a) {
$logic = ((strlen($sql_extra)) ? 0 : 1);
- $safesql = (($safe > 0) ? " and not ( xchan_flags & " . intval(XCHAN_FLAGS_CENSORED) . " ) " : '');
+ $safesql = (($safe > 0) ? " and not ( xchan_flags & " . intval(XCHAN_FLAGS_CENSORED|XCHAN_FLAGS_SELFCENSORED) . " ) " : '');
if($safe < 0)
- $safesql = " and ( xchan_flags & " . intval(XCHAN_FLAGS_CENSORED) . " ) ";
+ $safesql = " and ( xchan_flags & " . intval(XCHAN_FLAGS_CENSORED|XCHAN_FLAGS_SELFCENSORED) . " ) ";
if($limit)
$qlimit = " LIMIT $limit ";
diff --git a/mod/settings.php b/mod/settings.php
index fea9c9f72..9c60c0ec2 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -361,7 +361,13 @@ function settings_post(&$a) {
$post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0);
$post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
$post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
+ $adult = (($_POST['adult'] == 1) ? 1 : 0);
+ $channel = $a->get_channel();
+ $pageflags = $channel['channel_pageflags'];
+ $existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0);
+ if($adult != $existing_adult)
+ $pageflags = ($pageflags ^ PAGE_ADULT);
$arr = array();
$arr['channel_r_stream'] = (($_POST['view_stream']) ? $_POST['view_stream'] : 0);
@@ -518,8 +524,9 @@ function settings_post(&$a) {
);
*/
- $r = q("update channel set channel_name = '%s', channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d where channel_id = %d limit 1",
+ $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d where channel_id = %d limit 1",
dbesc($username),
+ intval($pageflags),
dbesc($timezone),
dbesc($defloc),
intval($notify),
@@ -929,6 +936,7 @@ function settings_content(&$a) {
$maxreq = $channel['channel_max_friend_req'];
$expire = $channel['channel_expire_days'];
+ $adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT);
$blockwall = $a->user['blockwall'];
$unkmail = $a->user['unkmail'];
@@ -1034,6 +1042,7 @@ function settings_content(&$a) {
'$defloc' => array('defloc', t('Default Post Location:'), $defloc, ''),
'$allowloc' => array('allow_location', t('Use Browser Location:'), ((get_pconfig(local_user(),'system','use_browser_location')) ? 1 : ''), ''),
+ '$adult' => array('adult', t('Adult Content'), $adult_flag, t('This channel publishes adult content.')),
'$h_prv' => t('Security and Privacy Settings'),
diff --git a/mod/zfinger.php b/mod/zfinger.php
index e1e19054e..49d07a40c 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -72,8 +72,8 @@ function zfinger_init(&$a) {
$id = $e['channel_id'];
$special_channel = (($e['channel_pageflags'] & PAGE_PREMIUM) ? true : false);
-
- $searchable = (($e['channel_pageflags'] & PAGE_HIDDEN) ? false : true);
+ $adult_channel = (($e['channel_pageflags'] & PAGE_ADULT) ? true : false);
+ $searchable = (($e['channel_pageflags'] & PAGE_HIDDEN) ? false : true);
if($e['xchan_flags'] & XCHAN_FLAGS_HIDDEN)
$searchable = false;
@@ -136,7 +136,8 @@ function zfinger_init(&$a) {
$ret['target'] = $ztarget;
$ret['target_sig'] = $zsig;
$ret['searchable'] = $searchable;
-
+ $ret['adult_content'] = $adult_channel;
+
// premium or other channel desiring some contact with potential followers before connecting.
// This is a template - %s will be replaced with the follow_url we discover for the return channel.
diff --git a/version.inc b/version.inc
index cb906c9a2..cc6bda10c 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-09-20.442
+2013-09-22.444
diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl
index f50e5dd74..10378e599 100755
--- a/view/tpl/settings.tpl
+++ b/view/tpl/settings.tpl
@@ -13,6 +13,7 @@
{{include file="field_input.tpl" field=$defloc}}
{{include file="field_checkbox.tpl" field=$allowloc}}
+{{include file="field_checkbox.tpl" field=$adult}}
<div class="settings-submit-wrapper" >
<input type="submit" name="submit" class="settings-submit" value="{{$submit}}" />