From cdfb5f9dc740734fbd95363a026ab44ae1dd9d94 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 22 Sep 2013 20:38:24 -0700 Subject: adult channel setting --- mod/dirsearch.php | 4 ++-- mod/settings.php | 11 ++++++++++- mod/zfinger.php | 7 ++++--- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'mod') 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. -- cgit v1.2.3