Rewrites:
From: ```` <?php $arr = []; $arr['foo'] = "FOO"; ```` To: ```` <?php $arr['foo'] = "FOO"; ````
This commit is contained in:
parent
ebf3b7e62d
commit
1f9fc13d03
|
@ -173,22 +173,23 @@ function events_post(App $a)
|
||||||
$private_event = true;
|
$private_event = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$datarray = [];
|
$datarray = [
|
||||||
$datarray['start'] = $start;
|
'start' => $start,
|
||||||
$datarray['finish'] = $finish;
|
'finish' => $finish,
|
||||||
$datarray['summary'] = $summary;
|
'summary' => $summary,
|
||||||
$datarray['desc'] = $desc;
|
'desc' => $desc,
|
||||||
$datarray['location'] = $location;
|
'location' => $location,
|
||||||
$datarray['type'] = $type;
|
'type' => $type,
|
||||||
$datarray['nofinish'] = $nofinish;
|
'nofinish' => $nofinish,
|
||||||
$datarray['uid'] = $uid;
|
'uid' => $uid,
|
||||||
$datarray['cid'] = $cid;
|
'cid' => $cid,
|
||||||
$datarray['allow_cid'] = $str_contact_allow;
|
'allow_cid' => $str_contact_allow,
|
||||||
$datarray['allow_gid'] = $str_group_allow;
|
'allow_gid' => $str_group_allow,
|
||||||
$datarray['deny_cid'] = $str_contact_deny;
|
'deny_cid' => $str_contact_deny,
|
||||||
$datarray['deny_gid'] = $str_group_deny;
|
'deny_gid' => $str_group_deny,
|
||||||
$datarray['private'] = $private_event;
|
'private' => $private_event,
|
||||||
$datarray['id'] = $event_id;
|
'id' => $event_id,
|
||||||
|
];
|
||||||
|
|
||||||
if (intval($_REQUEST['preview'])) {
|
if (intval($_REQUEST['preview'])) {
|
||||||
System::httpExit(Event::getHTML($datarray));
|
System::httpExit(Event::getHTML($datarray));
|
||||||
|
|
136
mod/item.php
136
mod/item.php
|
@ -307,7 +307,7 @@ function item_post(App $a) {
|
||||||
// for non native networks use the network of the original post as network of the item
|
// for non native networks use the network of the original post as network of the item
|
||||||
if (($toplevel_item['network'] != Protocol::DIASPORA)
|
if (($toplevel_item['network'] != Protocol::DIASPORA)
|
||||||
&& ($toplevel_item['network'] != Protocol::OSTATUS)
|
&& ($toplevel_item['network'] != Protocol::OSTATUS)
|
||||||
&& ($network == "")) {
|
&& ($network == '')) {
|
||||||
$network = $toplevel_item['network'];
|
$network = $toplevel_item['network'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ function item_post(App $a) {
|
||||||
|
|
||||||
$data = BBCode::getAttachmentData($body);
|
$data = BBCode::getAttachmentData($body);
|
||||||
$match = [];
|
$match = [];
|
||||||
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data["type"]))
|
if ((preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", $body, $match, PREG_SET_ORDER) || isset($data['type']))
|
||||||
&& ($posttype != Item::PT_PERSONAL_NOTE)) {
|
&& ($posttype != Item::PT_PERSONAL_NOTE)) {
|
||||||
$posttype = Item::PT_PAGE;
|
$posttype = Item::PT_PAGE;
|
||||||
$objecttype = Activity\ObjectType::BOOKMARK;
|
$objecttype = Activity\ObjectType::BOOKMARK;
|
||||||
|
@ -477,11 +477,11 @@ function item_post(App $a) {
|
||||||
$objecttype = Activity\ObjectType::NOTE; // Default value
|
$objecttype = Activity\ObjectType::NOTE; // Default value
|
||||||
$objectdata = BBCode::getAttachedData($body);
|
$objectdata = BBCode::getAttachedData($body);
|
||||||
|
|
||||||
if ($objectdata["type"] == "link") {
|
if ($objectdata['type'] == 'link') {
|
||||||
$objecttype = Activity\ObjectType::BOOKMARK;
|
$objecttype = Activity\ObjectType::BOOKMARK;
|
||||||
} elseif ($objectdata["type"] == "video") {
|
} elseif ($objectdata['type'] == 'video') {
|
||||||
$objecttype = Activity\ObjectType::VIDEO;
|
$objecttype = Activity\ObjectType::VIDEO;
|
||||||
} elseif ($objectdata["type"] == "photo") {
|
} elseif ($objectdata['type'] == 'photo') {
|
||||||
$objecttype = Activity\ObjectType::IMAGE;
|
$objecttype = Activity\ObjectType::IMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ function item_post(App $a) {
|
||||||
$verb = Activity::POST;
|
$verb = Activity::POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($network == "") {
|
if ($network == '') {
|
||||||
$network = Protocol::DFRN;
|
$network = Protocol::DFRN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,68 +532,65 @@ function item_post(App $a) {
|
||||||
$thr_parent_uri = $uri;
|
$thr_parent_uri = $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
$datarray = [];
|
$datarray = [
|
||||||
$datarray['uid'] = $profile_uid;
|
'uid' => $profile_uid,
|
||||||
$datarray['wall'] = $wall;
|
'wall' => $wall,
|
||||||
$datarray['gravity'] = $gravity;
|
'gravity' => $gravity,
|
||||||
$datarray['network'] = $network;
|
'network' => $network,
|
||||||
$datarray['contact-id'] = $contact_id;
|
'contact-id' => $contact_id,
|
||||||
$datarray['owner-name'] = $contact_record['name'] ?? '';
|
'owner-name' => $contact_record['name'] ?? '',
|
||||||
$datarray['owner-link'] = $contact_record['url'] ?? '';
|
'owner-link' => $contact_record['url'] ?? '',
|
||||||
$datarray['owner-avatar'] = $contact_record['thumb'] ?? '';
|
'owner-avatar' => $contact_record['thumb'] ?? '',
|
||||||
$datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
|
'author-name' => $author['name'],
|
||||||
$datarray['author-name'] = $author['name'];
|
'author-link' => $author['url'],
|
||||||
$datarray['author-link'] = $author['url'];
|
'author-avatar' => $author['thumb'],
|
||||||
$datarray['author-avatar'] = $author['thumb'];
|
'created' => empty($_REQUEST['created_at']) ? DateTimeFormat::utcNow() : $_REQUEST['created_at'],
|
||||||
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link']);
|
'received' => DateTimeFormat::utcNow(),
|
||||||
$datarray['created'] = empty($_REQUEST['created_at']) ? DateTimeFormat::utcNow() : $_REQUEST['created_at'];
|
'extid' => $extid,
|
||||||
$datarray['edited'] = $datarray['created'];
|
'guid' => $guid,
|
||||||
$datarray['commented'] = $datarray['created'];
|
'uri' => $uri,
|
||||||
$datarray['changed'] = $datarray['created'];
|
'title' => $title,
|
||||||
$datarray['received'] = DateTimeFormat::utcNow();
|
'body' => $body,
|
||||||
$datarray['extid'] = $extid;
|
'app' => $app,
|
||||||
$datarray['guid'] = $guid;
|
'location' => $location,
|
||||||
$datarray['uri'] = $uri;
|
'coord' => $coord,
|
||||||
$datarray['title'] = $title;
|
'file' => $categories,
|
||||||
$datarray['body'] = $body;
|
'inform' => $inform,
|
||||||
$datarray['app'] = $app;
|
'verb' => $verb,
|
||||||
$datarray['location'] = $location;
|
'post-type' => $posttype,
|
||||||
$datarray['coord'] = $coord;
|
'object-type' => $objecttype,
|
||||||
$datarray['file'] = $categories;
|
'allow_cid' => $str_contact_allow,
|
||||||
$datarray['inform'] = $inform;
|
'allow_gid' => $str_group_allow,
|
||||||
$datarray['verb'] = $verb;
|
'deny_cid' => $str_contact_deny,
|
||||||
$datarray['post-type'] = $posttype;
|
'deny_gid' => $str_group_deny,
|
||||||
$datarray['object-type'] = $objecttype;
|
'private' => $private,
|
||||||
$datarray['allow_cid'] = $str_contact_allow;
|
'pubmail' => $pubmail_enabled,
|
||||||
$datarray['allow_gid'] = $str_group_allow;
|
'attach' => $attachments,
|
||||||
$datarray['deny_cid'] = $str_contact_deny;
|
'thr-parent' => $thr_parent_uri,
|
||||||
$datarray['deny_gid'] = $str_group_deny;
|
'postopts' => $postopts,
|
||||||
$datarray['private'] = $private;
|
'origin' => $origin,
|
||||||
$datarray['pubmail'] = $pubmail_enabled;
|
'object' => $object,
|
||||||
$datarray['attach'] = $attachments;
|
'attachments' => $_REQUEST['attachments'] ?? [],
|
||||||
|
|
||||||
$datarray['thr-parent'] = $thr_parent_uri;
|
|
||||||
|
|
||||||
$datarray['postopts'] = $postopts;
|
|
||||||
$datarray['origin'] = $origin;
|
|
||||||
$datarray['object'] = $object;
|
|
||||||
|
|
||||||
$datarray['attachments'] = $_REQUEST['attachments'] ?? [];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These fields are for the convenience of addons...
|
* These fields are for the convenience of addons...
|
||||||
* 'self' if true indicates the owner is posting on their own wall
|
* 'self' if true indicates the owner is posting on their own wall
|
||||||
* If parent is 0 it is a top-level post.
|
* If parent is 0 it is a top-level post.
|
||||||
*/
|
*/
|
||||||
$datarray['parent'] = $toplevel_item_id;
|
'parent' => $toplevel_item_id,
|
||||||
$datarray['self'] = $self;
|
'self' => $self,
|
||||||
|
|
||||||
// This triggers posts via API and the mirror functions
|
// This triggers posts via API and the mirror functions
|
||||||
$datarray['api_source'] = $api_source;
|
'api_source' => $api_source,
|
||||||
|
|
||||||
// This field is for storing the raw conversation data
|
// This field is for storing the raw conversation data
|
||||||
$datarray['protocol'] = Conversation::PARCEL_DIRECT;
|
'protocol' => Conversation::PARCEL_DIRECT,
|
||||||
$datarray['direction'] = Conversation::PUSH;
|
'direction' => Conversation::PUSH,
|
||||||
|
];
|
||||||
|
|
||||||
|
// These cannot be part of above initialization ...
|
||||||
|
$datarray['edited'] = $datarray['created'];
|
||||||
|
$datarray['commented'] = $datarray['created'];
|
||||||
|
$datarray['changed'] = $datarray['created'];
|
||||||
|
$datarray['owner-id'] = Contact::getIdForURL($datarray['owner-link']);
|
||||||
|
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link']);
|
||||||
|
|
||||||
$datarray['edit'] = $orig_post;
|
$datarray['edit'] = $orig_post;
|
||||||
|
|
||||||
|
@ -606,14 +603,14 @@ function item_post(App $a) {
|
||||||
if ($preview) {
|
if ($preview) {
|
||||||
// We set the datarray ID to -1 because in preview mode the dataray
|
// We set the datarray ID to -1 because in preview mode the dataray
|
||||||
// doesn't have an ID.
|
// doesn't have an ID.
|
||||||
$datarray["id"] = -1;
|
$datarray['id'] = -1;
|
||||||
$datarray["uri-id"] = -1;
|
$datarray['uri-id'] = -1;
|
||||||
$datarray["author-network"] = Protocol::DFRN;
|
$datarray['author-network'] = Protocol::DFRN;
|
||||||
$datarray["author-updated"] = '';
|
$datarray['author-updated'] = '';
|
||||||
$datarray["author-gsid"] = 0;
|
$datarray['author-gsid'] = 0;
|
||||||
$datarray["author-uri-id"] = ItemURI::getIdByURI($datarray["author-link"]);
|
$datarray['author-uri-id'] = ItemURI::getIdByURI($datarray['author-link']);
|
||||||
$datarray["owner-updated"] = '';
|
$datarray['owner-updated'] = '';
|
||||||
$datarray["has-media"] = false;
|
$datarray['has-media'] = false;
|
||||||
$datarray['body'] = Item::improveSharedDataInBody($datarray);
|
$datarray['body'] = Item::improveSharedDataInBody($datarray);
|
||||||
|
|
||||||
$o = DI::conversation()->create([array_merge($contact_record, $datarray)], 'search', false, true);
|
$o = DI::conversation()->create([array_merge($contact_record, $datarray)], 'search', false, true);
|
||||||
|
@ -807,6 +804,7 @@ function item_content(App $a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'block':
|
case 'block':
|
||||||
$item = Post::selectFirstForUser(local_user(), ['guid', 'author-id', 'parent', 'gravity'], ['id' => $args->get(2)]);
|
$item = Post::selectFirstForUser(local_user(), ['guid', 'author-id', 'parent', 'gravity'], ['id' => $args->get(2)]);
|
||||||
if (empty($item['author-id'])) {
|
if (empty($item['author-id'])) {
|
||||||
|
|
|
@ -35,8 +35,8 @@ use Friendica\Protocol\Activity;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
use Friendica\Worker\Delivery;
|
use Friendica\Worker\Delivery;
|
||||||
|
|
||||||
function tagger_content(App $a) {
|
function tagger_content(App $a)
|
||||||
|
{
|
||||||
if (!Session::isAuthenticated()) {
|
if (!Session::isAuthenticated()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -116,41 +116,41 @@ EOT;
|
||||||
|
|
||||||
$termlink = html_entity_decode('⌗') . '[url=' . DI::baseUrl() . '/search?tag=' . $term . ']'. $term . '[/url]';
|
$termlink = html_entity_decode('⌗') . '[url=' . DI::baseUrl() . '/search?tag=' . $term . ']'. $term . '[/url]';
|
||||||
|
|
||||||
$arr = [];
|
|
||||||
|
|
||||||
$arr['guid'] = System::createUUID();
|
|
||||||
$arr['uri'] = $uri;
|
|
||||||
$arr['uid'] = $owner_uid;
|
|
||||||
$arr['contact-id'] = $contact['id'];
|
|
||||||
$arr['wall'] = $item['wall'];
|
|
||||||
$arr['gravity'] = Item::GRAVITY_COMMENT;
|
|
||||||
$arr['parent'] = $item['id'];
|
|
||||||
$arr['thr-parent'] = $item['uri'];
|
|
||||||
$arr['owner-name'] = $item['author-name'];
|
|
||||||
$arr['owner-link'] = $item['author-link'];
|
|
||||||
$arr['owner-avatar'] = $item['author-avatar'];
|
|
||||||
$arr['author-name'] = $contact['name'];
|
|
||||||
$arr['author-link'] = $contact['url'];
|
|
||||||
$arr['author-avatar'] = $contact['thumb'];
|
|
||||||
|
|
||||||
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
||||||
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
|
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
|
||||||
$plink = '[url=' . $item['plink'] . ']' . $post_type . '[/url]';
|
$plink = '[url=' . $item['plink'] . ']' . $post_type . '[/url]';
|
||||||
$arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink, $termlink );
|
|
||||||
|
|
||||||
$arr['verb'] = Activity::TAG;
|
$arr = [
|
||||||
$arr['target-type'] = $targettype;
|
'guid' => System::createUUID(),
|
||||||
$arr['target'] = $target;
|
'uri' => $uri,
|
||||||
$arr['object-type'] = $objtype;
|
'uid' => $owner_uid,
|
||||||
$arr['object'] = $obj;
|
'contact-id' => $contact['id'],
|
||||||
$arr['private'] = $item['private'];
|
'wall' => $item['wall'],
|
||||||
$arr['allow_cid'] = $item['allow_cid'];
|
'gravity' => Item::GRAVITY_COMMENT,
|
||||||
$arr['allow_gid'] = $item['allow_gid'];
|
'parent' => $item['id'],
|
||||||
$arr['deny_cid'] = $item['deny_cid'];
|
'thr-parent' => $item['uri'],
|
||||||
$arr['deny_gid'] = $item['deny_gid'];
|
'owner-name' => $item['author-name'],
|
||||||
$arr['visible'] = 1;
|
'owner-link' => $item['author-link'],
|
||||||
$arr['unseen'] = 1;
|
'owner-avatar' => $item['author-avatar'],
|
||||||
$arr['origin'] = 1;
|
'author-name' => $contact['name'],
|
||||||
|
'author-link' => $contact['url'],
|
||||||
|
'author-avatar' => $contact['thumb'],
|
||||||
|
'body' => sprintf( $bodyverb, $ulink, $alink, $plink, $termlink),
|
||||||
|
'verb' => Activity::TAG,
|
||||||
|
'target-type' => $targettype,
|
||||||
|
'target' => $target,
|
||||||
|
'object-type' => $objtype,
|
||||||
|
'object' => $obj,
|
||||||
|
'private' => $item['private'],
|
||||||
|
'allow_cid' => $item['allow_cid'],
|
||||||
|
'allow_gid' => $item['allow_gid'],
|
||||||
|
'deny_cid' => $item['deny_cid'],
|
||||||
|
'deny_gid' => $item['deny_gid'],
|
||||||
|
'visible' => 1,
|
||||||
|
'unseen' => 1,
|
||||||
|
'origin' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
$post_id = Item::insert($arr);
|
$post_id = Item::insert($arr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user