more prep work for collections

This commit is contained in:
zotlabs 2019-03-23 15:23:59 -07:00
parent c3e9840a7d
commit 3a95d71821
3 changed files with 28 additions and 20 deletions

View file

@ -35,6 +35,13 @@ class Connect {
$protocol = substr($url,1,$x-1);
$url = substr($url,$x+1);
}
}
$category = null;
if(strpos($url,'$') !== false) {
}
if(! allowed_url($url)) {

View file

@ -142,7 +142,7 @@ class Channel {
$unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0);
$cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0);
$suggestme = ((x($_POST,'suggestme')) ? intval($_POST['suggestme']) : 0);
$anymention = ((x($_POST,'anymention')) ? intval($_POST['anymention']) : 0);
// $anymention = ((x($_POST,'anymention')) ? intval($_POST['anymention']) : 0);
// $hyperdrive = ((x($_POST,'hyperdrive')) ? intval($_POST['hyperdrive']) : 0);
@ -260,7 +260,7 @@ class Channel {
set_pconfig(local_channel(),'system','default_permcat',$defpermcat);
set_pconfig(local_channel(),'system','email_notify_host',$mailhost);
set_pconfig(local_channel(),'system','profile_assign',$profile_assign);
set_pconfig(local_channel(),'system','anymention',$anymention);
// set_pconfig(local_channel(),'system','anymention',$anymention);
// set_pconfig(local_channel(),'system','hyperdrive',$hyperdrive);
set_pconfig(local_channel(),'system','force_public_uploads',$public_uploads);
set_pconfig(local_channel(),'system','autoperms',$autoperms);
@ -493,12 +493,12 @@ class Channel {
if(in_array($permissions_role,['forum','repository'])) {
$autoperms = replace_macros(get_markup_template('field_checkbox.tpl'), [
'$field' => [ 'autoperms',t('Automatic membership approval'), ((get_pconfig(local_channel(),'system','autoperms',0)) ? 1 : 0), t('If enabled, connection requests will be approved without your interaction'), $yes_no ]]);
$anymention = replace_macros(get_markup_template('field_checkbox.tpl'), [
'$field' => [ 'anymention', t('Allow forum delivery with @mentions'), ((get_pconfig(local_channel(),'system','anymention')) ? 1 : 0), t('Allows delivery from projects which do not support !mentions for forums.'), $yes_no ]]);
// $anymention = replace_macros(get_markup_template('field_checkbox.tpl'), [
// '$field' => [ 'anymention', t('Allow forum delivery with @mentions'), ((get_pconfig(local_channel(),'system','anymention')) ? 1 : 0), t('Allows delivery from projects which do not support !mentions for forums.'), $yes_no ]]);
}
else {
$autoperms = '<input type="hidden" name="autoperms" value="' . intval(get_pconfig(local_channel(),'system','autoperms')) . '" />';
$anymention = '<input type="hidden" name="anymention" value="' . intval(get_pconfig(local_channel(),'system','anymention')) . '" />';
// $anymention = '<input type="hidden" name="anymention" value="' . intval(get_pconfig(local_channel(),'system','anymention')) . '" />';
}
// $hyperdrive = [ 'hyperdrive', t('Enable hyperdrive'), ((get_pconfig(local_channel(),'system','hyperdrive',true)) ? 1 : 0), t('Dramatically increases the content available in your stream.'), $yes_no ];
@ -582,7 +582,7 @@ class Channel {
'$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), intval($channel['channel_max_anon_mail']) ,t("Useful to reduce spamming")),
'$autoperms' => $autoperms,
'$anymention' => $anymention,
// '$anymention' => $anymention,
// '$hyperdrive' => $hyperdrive,
'$h_not' => t('Notification Settings'),

View file

@ -1265,7 +1265,7 @@ function decode_item_meta($meta) {
* @return string
*/
function termtype($t) {
$types = array('unknown','hashtag','mention','category','private_category','file','search','thing','bookmark', 'hierarchy', 'communitytag', 'forum');
$types = array('unknown','hashtag','mention','category','personal_category','file','search','thing','bookmark', 'hierarchy', 'communitytag', 'forum');
return(($types[$t]) ? $types[$t] : 'unknown');
}
@ -1296,7 +1296,7 @@ function decode_tags($t) {
case 'category':
$tag['ttype'] = TERM_CATEGORY;
break;
case 'private_category':
case 'personal_category':
$tag['ttype'] = TERM_PCATEGORY;
break;
case 'file':
@ -2529,7 +2529,7 @@ function tag_deliver($uid, $item_id) {
* Now we've got those out of the way. Let's see if this is a post that's tagged for re-delivery
*/
$terms = array_merge(get_terms_oftype($item['term'],TERM_MENTION),get_terms_oftype($item['term'],TERM_FORUM));
$terms = array_merge(get_terms_oftype($item['term'],TERM_MENTION),get_terms_oftype($item['term'],TERM_PCATEGORY));
if($terms)
logger('Post mentions: ' . print_r($terms,true), LOGGER_DATA);
@ -2544,6 +2544,7 @@ function tag_deliver($uid, $item_id) {
if($terms) {
foreach($terms as $term) {
if(! link_compare($term['url'],$link)) {
continue;
}
@ -2563,7 +2564,7 @@ function tag_deliver($uid, $item_id) {
$body = preg_replace('/\[share(.*?)\[\/share\]/','',$item['body']);
$tagged = false;
$plustagged = false;
$ptagged = false;
$matches = array();
$pattern = '/[\!@]\!?\[[uz]rl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'],'/') . '\[\/[uz]rl\]/';
@ -2575,15 +2576,15 @@ function tag_deliver($uid, $item_id) {
$tagged = true;
if(! ($tagged || $plustagged)) {
if(! ($tagged || $ptagged)) {
logger('Mention was in a reshare or exceeded max_tagged_forums - ignoring');
continue;
}
$arr = [
'channel_id' => $uid,
'item' => $item,
'body' => $body
'channel_id' => $uid,
'item' => $item,
'body' => $body
];
/**
* @hooks tagged
@ -2610,14 +2611,14 @@ function tag_deliver($uid, $item_id) {
// Just a normal tag?
if(! $plustagged) {
logger('Not a plus tag', LOGGER_DEBUG);
if(! $ptagged) {
logger('Not a ptag', LOGGER_DEBUG);
continue;
}
// plustagged - keep going, next check permissions
if(! perm_is_allowed($uid,$item['author_xchan'],'tag_deliver')) {
// ptagged - keep going, next check permissions
// @fixme
if(! perm_is_allowed($uid,$item['author_xchan'],'write_collection')) {
logger('tag_delivery denied for uid ' . $uid . ' and xchan ' . $item['author_xchan']);
continue;
}
@ -2762,7 +2763,7 @@ function tgroup_check($uid, $item) {
return false;
$terms = array_merge(get_terms_oftype($item['term'],TERM_MENTION),get_terms_oftype($item['term'],TERM_FORUM));
$terms = array_merge(get_terms_oftype($item['term'],TERM_MENTION),get_terms_oftype($item['term'],TERM_PCATEGORY));
if($terms)
logger('tgroup_check: post mentions: ' . print_r($terms,true), LOGGER_DATA);