]> git.mxchange.org Git - friendica.git/blobdiff - include/like.php
It is now possible again to like yourself
[friendica.git] / include / like.php
index 31698658a2c359572bdd7eb456341903f4a97b22..1dbdcc936d727fc10fd05969674cfe8feeb06ed6 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -85,7 +86,7 @@ function do_like($item_id, $verb) {
                $uid = local_user();
        }
 
-       if (!can_write_wall($a, $uid)) {
+       if (!can_write_wall($uid)) {
                logger('like: unable to write on wall ' . $uid);
                return false;
        }
@@ -151,7 +152,7 @@ function do_like($item_id, $verb) {
                AND (`parent` = '%s' OR `parent-uri` = '%s' OR `thr-parent` = '%s')
                LIMIT 1",
                intval($author_contact['id']),
-               intval($uid),
+               intval($item['uid']),
                dbesc($item_id), dbesc($item_id), dbesc($item['uri'])
        );
 
@@ -168,7 +169,7 @@ function do_like($item_id, $verb) {
                // Clean up the Diaspora signatures for this like
                // Go ahead and do it even if Diaspora support is disabled. We still want to clean up
                // if it had been enabled in the past
-               dba::delete('sign', array('iid' => $like_item['id']));
+               dba::delete('sign', ['iid' => $like_item['id']]);
 
                $like_item_id = $like_item['id'];
                Worker::add(PRIORITY_HIGH, "Notifier", "like", $like_item_id);
@@ -208,10 +209,10 @@ EOT;
        $alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
        $plink = '[url=' . System::baseUrl() . '/display/' . $owner_self_contact['nick'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
 
-       $new_item = array(
+       $new_item = [
                'guid'          => get_guid(32),
-               'uri'           => item_new_uri($a->get_hostname(), $uid),
-               'uid'           => $uid,
+               'uri'           => item_new_uri($a->get_hostname(), $item['uid']),
+               'uid'           => $item['uid'],
                'contact-id'    => $item_contact_id,
                'type'          => 'activity',
                'wall'          => $item['wall'],
@@ -238,8 +239,7 @@ EOT;
                'deny_gid'      => $item['deny_gid'],
                'visible'       => 1,
                'unseen'        => 1,
-               'last-child'    => 0
-       );
+       ];
 
        $new_item_id = item_store($new_item);
 
@@ -255,7 +255,7 @@ EOT;
 
        $new_item['id'] = $new_item_id;
 
-       call_hooks('post_local_end', $new_item);
+       Addon::callHooks('post_local_end', $new_item);
 
        Worker::add(PRIORITY_HIGH, "Notifier", "like", $new_item_id);