typo in profile_selectors, fix remote tagging
This commit is contained in:
parent
ae2aa74444
commit
928faf3b97
|
@ -2227,10 +2227,10 @@ function local_delivery($importer,$data) {
|
||||||
logger('local_delivery: received remote comment');
|
logger('local_delivery: received remote comment');
|
||||||
$is_like = false;
|
$is_like = false;
|
||||||
// remote reply to our post. Import and then notify everybody else.
|
// remote reply to our post. Import and then notify everybody else.
|
||||||
|
|
||||||
$datarray = get_atom_elements($feed,$item);
|
$datarray = get_atom_elements($feed,$item);
|
||||||
|
|
||||||
|
$r = q("SELECT `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
$r = q("SELECT `id`, `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
|
||||||
dbesc($item_id),
|
dbesc($item_id),
|
||||||
intval($importer['importer_uid'])
|
intval($importer['importer_uid'])
|
||||||
);
|
);
|
||||||
|
@ -2266,14 +2266,22 @@ function local_delivery($importer,$data) {
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// our user with $importer['importer_uid'] is the owner
|
||||||
|
|
||||||
|
$own = q("select name,url,thumb from contact where uid = %d and self = 1 limit 1",
|
||||||
|
intval($importer['importer_uid'])
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$datarray['type'] = 'remote-comment';
|
$datarray['type'] = 'remote-comment';
|
||||||
$datarray['wall'] = 1;
|
$datarray['wall'] = 1;
|
||||||
$datarray['parent-uri'] = $parent_uri;
|
$datarray['parent-uri'] = $parent_uri;
|
||||||
$datarray['uid'] = $importer['importer_uid'];
|
$datarray['uid'] = $importer['importer_uid'];
|
||||||
$datarray['owner-name'] = $r[0]['name'];
|
$datarray['owner-name'] = $own[0]['name'];
|
||||||
$datarray['owner-link'] = $r[0]['url'];
|
$datarray['owner-link'] = $own[0]['url'];
|
||||||
$datarray['owner-avatar'] = $r[0]['thumb'];
|
$datarray['owner-avatar'] = $own[0]['thumb'];
|
||||||
$datarray['contact-id'] = $importer['id'];
|
$datarray['contact-id'] = $importer['id'];
|
||||||
|
|
||||||
if(($datarray['verb'] === ACTIVITY_LIKE) || ($datarray['verb'] === ACTIVITY_DISLIKE)) {
|
if(($datarray['verb'] === ACTIVITY_LIKE) || ($datarray['verb'] === ACTIVITY_DISLIKE)) {
|
||||||
$is_like = true;
|
$is_like = true;
|
||||||
$datarray['type'] = 'activity';
|
$datarray['type'] = 'activity';
|
||||||
|
@ -2290,26 +2298,34 @@ function local_delivery($importer,$data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($datarray['verb'] === ACTIVITY_TAG) && ($datarray['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
|
if(($datarray['verb'] === ACTIVITY_TAG) && ($datarray['object-type'] === ACTIVITY_OBJ_TAGTERM)) {
|
||||||
|
|
||||||
|
|
||||||
$xo = parse_xml_string($datarray['object'],false);
|
$xo = parse_xml_string($datarray['object'],false);
|
||||||
$xt = parse_xml_string($datarray['target'],false);
|
$xt = parse_xml_string($datarray['target'],false);
|
||||||
|
|
||||||
if(($xt->type == ACTIVITY_OBJ_NOTE) && ($xt->id == $r[0]['uri'])) {
|
if(($xt->type == ACTIVITY_OBJ_NOTE) && ($xt->id)) {
|
||||||
|
|
||||||
|
// fetch the parent item
|
||||||
|
|
||||||
|
$tagp = q("select * from item where uri = '%s' and uid = %d limit 1",
|
||||||
|
dbesc($xt->id),
|
||||||
|
intval($importer['importer_uid'])
|
||||||
|
);
|
||||||
|
if(! count($tagp))
|
||||||
|
continue;
|
||||||
|
|
||||||
// extract tag, if not duplicate, and this user allows tags, add to parent item
|
// extract tag, if not duplicate, and this user allows tags, add to parent item
|
||||||
|
|
||||||
if($xo->id && $xo->content) {
|
if($xo->id && $xo->content) {
|
||||||
$newtag = '#[url=' . $xo->id . ']'. $xo->content . '[/url]';
|
$newtag = '#[url=' . $xo->id . ']'. $xo->content . '[/url]';
|
||||||
|
if(! (stristr($tagp[0]['tag'],$newtag))) {
|
||||||
if(! (stristr($r[0]['tag'],$newtag))) {
|
|
||||||
$i = q("SELECT `blocktags` FROM `user` where `uid` = %d LIMIT 1",
|
$i = q("SELECT `blocktags` FROM `user` where `uid` = %d LIMIT 1",
|
||||||
intval($importer['importer_uid'])
|
intval($importer['importer_uid'])
|
||||||
);
|
);
|
||||||
if(count($i) && ! ($i[0]['blocktags'])) {
|
if(count($i) && ! intval($i[0]['blocktags'])) {
|
||||||
q("UPDATE item SET tag = '%s' WHERE id = %d LIMIT 1",
|
q("UPDATE item SET tag = '%s', `edited` = '%s' WHERE id = %d LIMIT 1",
|
||||||
dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . $newtag),
|
dbesc($tagp[0]['tag'] . (strlen($tagp[0]['tag']) ? ',' : '') . $newtag),
|
||||||
intval($r[0]['id'])
|
intval($tagp[0]['id']),
|
||||||
|
dbesc(datetime_convert())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ function gender_selector($current="",$suffix="") {
|
||||||
|
|
||||||
$o .= "<select name=\"gender$suffix\" id=\"gender-select$suffix\" size=\"1\" >";
|
$o .= "<select name=\"gender$suffix\" id=\"gender-select$suffix\" size=\"1\" >";
|
||||||
foreach($select as $selection) {
|
foreach($select as $selection) {
|
||||||
if($selection !== 'NOTRANSLATION')) {
|
if($selection !== 'NOTRANSLATION') {
|
||||||
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
||||||
$o .= "<option value=\"$selection\" $selected >$selection</option>";
|
$o .= "<option value=\"$selection\" $selected >$selection</option>";
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ function sexpref_selector($current="",$suffix="") {
|
||||||
|
|
||||||
$o .= "<select name=\"sexual$suffix\" id=\"sexual-select$suffix\" size=\"1\" >";
|
$o .= "<select name=\"sexual$suffix\" id=\"sexual-select$suffix\" size=\"1\" >";
|
||||||
foreach($select as $selection) {
|
foreach($select as $selection) {
|
||||||
if($selection !== 'NOTRANSLATION')) {
|
if($selection !== 'NOTRANSLATION') {
|
||||||
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
||||||
$o .= "<option value=\"$selection\" $selected >$selection</option>";
|
$o .= "<option value=\"$selection\" $selected >$selection</option>";
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ function marital_selector($current="",$suffix="") {
|
||||||
|
|
||||||
$o .= "<select name=\"marital\" id=\"marital-select\" size=\"1\" >";
|
$o .= "<select name=\"marital\" id=\"marital-select\" size=\"1\" >";
|
||||||
foreach($select as $selection) {
|
foreach($select as $selection) {
|
||||||
if($selection !== 'NOTRANSLATION')) {
|
if($selection !== 'NOTRANSLATION') {
|
||||||
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
$selected = (($selection == $current) ? ' selected="selected" ' : '');
|
||||||
$o .= "<option value=\"$selection\" $selected >$selection</option>";
|
$o .= "<option value=\"$selection\" $selected >$selection</option>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,14 +66,14 @@ function tagger_content(&$a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$uri = item_new_uri($a->get_hostname(),$owner_uid);
|
$uri = item_new_uri($a->get_hostname(),$owner_uid);
|
||||||
|
$xterm = xmlify($term);
|
||||||
$post_type = (($item['resource-id']) ? t('photo') : t('status'));
|
$post_type = (($item['resource-id']) ? t('photo') : t('status'));
|
||||||
$targettype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
|
$targettype = (($item['resource-id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
|
||||||
|
|
||||||
$link = xmlify('<link rel="alternate" type="text/html" href="'
|
$link = xmlify('<link rel="alternate" type="text/html" href="'
|
||||||
. $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
|
. $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
|
||||||
|
|
||||||
$body = $item['body'];
|
$body = xmlify($item['body']);
|
||||||
|
|
||||||
$target = <<< EOT
|
$target = <<< EOT
|
||||||
<target>
|
<target>
|
||||||
|
@ -95,8 +95,8 @@ EOT;
|
||||||
<local>1</local>
|
<local>1</local>
|
||||||
<id>$tagid</id>
|
<id>$tagid</id>
|
||||||
<link>$tagid</link>
|
<link>$tagid</link>
|
||||||
<title>$term</title>
|
<title>$xterm</title>
|
||||||
<content>$term</content>
|
<content>$xterm</content>
|
||||||
</object>
|
</object>
|
||||||
EOT;
|
EOT;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue