use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
+use Friendica\Protocol\Activity;
use Friendica\Util\Network;
use Friendica\Model\Item;
return;
}
if (PConfig::get($item['uid'], 'mailstream', 'nolikes')) {
- if ($item['verb'] == ACTIVITY_LIKE) {
+ if ($item['verb'] == Activity::LIKE) {
Logger::debug('mailstream: like item ' . $item['id']);
return;
}
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\User;
+use Friendica\Protocol\Activity;
use Friendica\Util\ConfigFileLoader;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
}
}
- if ($b['verb'] == ACTIVITY_LIKE) {
+ if ($b['verb'] == Activity::LIKE) {
if ($b['deleted']) {
pumpio_action($a, $b["uid"], $b["thr-parent"], "unlike");
} else {
return;
}
- if ($b['verb'] == ACTIVITY_DISLIKE) {
+ if ($b['verb'] == Activity::DISLIKE) {
return;
}
- if (($b['verb'] == ACTIVITY_POST) && ($b['created'] !== $b['edited']) && !$b['deleted']) {
+ if (($b['verb'] == Activity::POST) && ($b['created'] !== $b['edited']) && !$b['deleted']) {
pumpio_action($a, $b["uid"], $b["uri"], "update", $b["body"]);
}
- if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) {
+ if (($b['verb'] == Activity::POST) && $b['deleted']) {
pumpio_action($a, $b["uid"], $b["uri"], "delete");
}
$inReplyTo = ["id" => $orig_post["uri"],
"objectType" => "note"];
- if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA))) {
- $inReplyTo["objectType"] = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
+ if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], Activity\Namespaces::ACTIVITY_SCHEMA))) {
+ $inReplyTo["objectType"] = str_replace(Activity\Namespaces::ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
}
$params["object"] = [
$uri = $orig_post["uri"];
}
- if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA))) {
- $objectType = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
+ if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], Activity\Namespaces::ACTIVITY_SCHEMA))) {
+ $objectType = str_replace(Activity\Namespaces::ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
} elseif (strstr($uri, "/api/comment/")) {
$objectType = "comment";
} elseif (strstr($uri, "/api/note/")) {
}
}
- Item::delete(['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]);
+ Item::delete(['verb' => Activity::LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]);
if (DBA::isResult($r)) {
Logger::log("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
}
}
- $condition = ['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']];
+ $condition = ['verb' => Activity::LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']];
if (Item::exists($condition)) {
Logger::log("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']);
return;
$likedata = [];
$likedata['parent'] = $orig_post['id'];
- $likedata['verb'] = ACTIVITY_LIKE;
+ $likedata['verb'] = Activity::LIKE;
$likedata['gravity'] = GRAVITY_ACTIVITY;
$likedata['uid'] = $uid;
$likedata['wall'] = 0;
$objauthor = '[url=' . $orig_post['author-link'] . ']' . $orig_post['author-name'] . '[/url]';
$post_type = L10n::t('status');
$plink = '[url=' . $orig_post['plink'] . ']' . $post_type . '[/url]';
- $likedata['object-type'] = ACTIVITY_OBJ_NOTE;
+ $likedata['object-type'] = Activity::OBJ_NOTE;
$likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink);
- $likedata['object'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' .
+ $likedata['object'] = '<object><type>' . Activity::OBJ_NOTE . '</type><local>1</local>' .
'<id>' . $orig_post['uri'] . '</id><link>' . XML::escape('<link rel="alternate" type="text/html" href="' . XML::escape($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';
$ret = Item::insert($likedata);
$postarray['uid'] = $uid;
$postarray['wall'] = 0;
$postarray['uri'] = $post->object->id;
- $postarray['object-type'] = NAMESPACE_ACTIVITY_SCHEMA.strtolower($post->object->objectType);
+ $postarray['object-type'] = Activity\Namespaces::ACTIVITY_SCHEMA.strtolower($post->object->objectType);
if ($post->object->objectType != "comment") {
$contact_id = pumpio_get_contact($uid, $post->actor);
}
$postarray['contact-id'] = $contact_id;
- $postarray['verb'] = ACTIVITY_POST;
+ $postarray['verb'] = Activity::POST;
$postarray['owner-name'] = $post->actor->displayName;
$postarray['owner-link'] = $post->actor->url;
$postarray['author-name'] = $postarray['owner-name'];
use Friendica\Model\ItemContent;
use Friendica\Model\Photo;
use Friendica\Model\User;
+use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Strings;
}
}
- if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) {
+ if (($b['verb'] == Activity::POST) && $b['deleted']) {
statusnet_action($a, $b["uid"], substr($orig_post["uri"], $hostlength), "delete");
}
- if ($b['verb'] == ACTIVITY_LIKE) {
+ if ($b['verb'] == Activity::LIKE) {
Logger::log("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), Logger::DEBUG);
if ($b['deleted'])
statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike");
$postarray['thr-parent'] = $item['uri'];
$postarray['parent-uri'] = $item['parent-uri'];
$postarray['parent'] = $item['parent'];
- $postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
+ $postarray['object-type'] = Activity::OBJ_COMMENT;
} else {
$postarray['thr-parent'] = $postarray['uri'];
$postarray['parent-uri'] = $postarray['uri'];
- $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
+ $postarray['object-type'] = Activity::OBJ_NOTE;
}
// Is it me?
$create_user = false;
} else {
$postarray['parent-uri'] = $postarray['uri'];
- $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
+ $postarray['object-type'] = Activity::OBJ_NOTE;
}
if ($contactid == 0) {
$postarray['contact-id'] = $contactid;
- $postarray['verb'] = ACTIVITY_POST;
+ $postarray['verb'] = Activity::POST;
$postarray['author-name'] = $content->user->name;
$postarray['author-link'] = $content->user->statusnet_profile_url;
use Friendica\Model\ItemContent;
use Friendica\Model\User;
use Friendica\Object\Image;
+use Friendica\Protocol\Activity;
use Friendica\Util\ConfigFileLoader;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
}
}
- if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) {
+ if (($b['verb'] == Activity::POST) && $b['deleted']) {
twitter_action($a, $b["uid"], substr($orig_post["uri"], 9), "delete");
}
- if ($b['verb'] == ACTIVITY_LIKE) {
+ if ($b['verb'] == Activity::LIKE) {
Logger::log("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), Logger::DEBUG);
if ($b['deleted']) {
twitter_action($a, $b["uid"], substr($b["thr-parent"], 9), "unlike");
$media[$medium->url] .= "\n[img]" . $medium->media_url_https . '[/img]';
}
- $postarray['object-type'] = ACTIVITY_OBJ_IMAGE;
+ $postarray['object-type'] = Activity::OBJ_IMAGE;
break;
case 'video':
case 'animated_gif':
$media[$medium->url] .= "\n[img]" . $medium->media_url_https . '[/img]';
}
- $postarray['object-type'] = ACTIVITY_OBJ_VIDEO;
+ $postarray['object-type'] = Activity::OBJ_VIDEO;
if (is_array($medium->video_info->variants)) {
$bitrate = 0;
// We take the video with the highest bitrate
$postarray['thr-parent'] = $parent_item['uri'];
$postarray['parent-uri'] = $parent_item['parent-uri'];
$postarray['parent'] = $parent_item['parent'];
- $postarray['object-type'] = ACTIVITY_OBJ_COMMENT;
+ $postarray['object-type'] = Activity::OBJ_COMMENT;
} else {
$postarray['thr-parent'] = $postarray['uri'];
$postarray['parent-uri'] = $postarray['uri'];
- $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
+ $postarray['object-type'] = Activity::OBJ_NOTE;
}
// Is it me?
$create_user = false;
} else {
$postarray['parent-uri'] = $postarray['uri'];
- $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
+ $postarray['object-type'] = Activity::OBJ_NOTE;
}
if ($contactid == 0) {
$postarray['contact-id'] = $contactid;
- $postarray['verb'] = ACTIVITY_POST;
+ $postarray['verb'] = Activity::POST;
$postarray['author-name'] = $postarray['owner-name'];
$postarray['author-link'] = $postarray['owner-link'];
$postarray['author-avatar'] = $postarray['owner-avatar'];
// When the post contains links then use the correct object type
if (count($post->entities->urls) > 0) {
- $postarray['object-type'] = ACTIVITY_OBJ_BOOKMARK;
+ $postarray['object-type'] = Activity::OBJ_BOOKMARK;
}
// Search for media links
Item::insert($retweet);
// CHange the other post into a reshare activity
- $postarray['verb'] = ACTIVITY2_ANNOUNCE;
+ $postarray['verb'] = Activity::ANNOUNCE;
$postarray['gravity'] = GRAVITY_ACTIVITY;
- $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
+ $postarray['object-type'] = Activity::OBJ_NOTE;
$postarray['thr-parent'] = $retweet['uri'];
$postarray['parent-uri'] = $retweet['uri'];