]> git.mxchange.org Git - friendica.git/blob - mod/display.php
21fff7866c289f397fd18741f976edc3ed0aadda
[friendica.git] / mod / display.php
1 <?php
2
3 function display_init(&$a) {
4
5         if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
6                 return;
7         }
8
9         $nick = (($a->argc > 1) ? $a->argv[1] : '');
10         $profiledata = array();
11
12         // If there is only one parameter, then check if this parameter could be a guid
13         if ($a->argc == 2) {
14                 $nick = "";
15                 $itemuid = 0;
16
17                 // Does the local user have this item?
18                 if (local_user()) {
19                         $r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
20                                 WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
21                                         AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
22                         if (count($r)) {
23                                 $nick = $a->user["nickname"];
24                                 $itemuid = local_user();
25                         }
26                 }
27
28                 // Or is it anywhere on the server?
29                 if ($nick == "") {
30                         $r = q("SELECT `user`.`nickname`, `item`.`id`, `item`.`parent`, `item`.`author-name`,
31                                 `item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`owner-link`, `item`.`body`
32                                 FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
33                                 WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
34                                         AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''
35                                         AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''
36                                         AND NOT `item`.`private` AND NOT `user`.`hidewall`
37                                         AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
38                                 //      AND NOT `item`.`private` AND `item`.`wall`
39                         if (count($r)) {
40                                 $nick = $r[0]["nickname"];
41                                 $itemuid = $r[0]["uid"];
42                         }
43                 }
44
45                 // Is it an item with uid=0?
46                 if ($nick == "") {
47                         $r = q("SELECT `item`.`id`, `item`.`parent`, `item`.`author-name`, `item`.`author-link`,
48                                 `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`owner-link`, `item`.`body`
49                                 FROM `item` WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
50                                         AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''
51                                         AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''
52                                         AND NOT `item`.`private` AND `item`.`uid` = 0
53                                         AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
54                                 //      AND NOT `item`.`private` AND `item`.`wall`
55                 }
56                 if (count($r)) {
57                         if ($r[0]["id"] != $r[0]["parent"])
58                                 $r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
59                                         WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
60                                                 AND `id` = %d", $r[0]["parent"]);
61
62                         if (($itemuid != local_user()) AND local_user()) {
63                                 // Do we know this contact but we haven't got this item?
64                                 // Copy the wohle thread to our local storage so that we can interact.
65                                 // We really should change this need for the future since it scales very bad.
66                                 $contactid = get_contact($r[0]['owner-link'], local_user());
67                                 if ($contactid) {
68                                         $items = q("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id`", intval($r[0]["id"]));
69                                         foreach ($items AS $item) {
70                                                 $itemcontactid = get_contact($item['owner-link'], local_user());
71                                                 if (!$itemcontactid)
72                                                         $itemcontactid = $contactid;
73
74                                                 unset($item['id']);
75                                                 $item['uid'] = local_user();
76                                                 $item['origin'] = 0;
77                                                 $item['contact-id'] = $itemcontactid;
78                                                 $local_copy = item_store($item, false, false, true);
79                                                 logger("Stored local copy for post ".$item['guid']." under id ".$local_copy, LOGGER_DEBUG);
80                                         }
81                                 }
82                         }
83
84                         $profiledata = display_fetchauthor($a, $r[0]);
85
86                         if (strstr(normalise_link($profiledata["url"]), normalise_link($a->get_baseurl()))) {
87                                 $nickname = str_replace(normalise_link($a->get_baseurl())."/profile/", "", normalise_link($profiledata["url"]));
88
89                                 if (($nickname != $a->user["nickname"])) {
90                                         $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
91                                                 INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`
92                                                 WHERE `user`.`nickname` = '%s' AND `profile`.`is-default` AND `contact`.`self` LIMIT 1",
93                                                 dbesc($nickname)
94                                         );
95                                         if (count($r))
96                                                 $profiledata = $r[0];
97
98                                         $profiledata["network"] = NETWORK_DFRN;
99                                 } else
100                                         $profiledata = array();
101                         }
102                 } else {
103                         $a->error = 404;
104                         notice( t('Item not found.') . EOL);
105                         return;
106                 }
107         }
108
109         profile_load($a, $nick, 0, $profiledata);
110
111 }
112
113 function display_fetchauthor($a, $item) {
114
115         $profiledata = array();
116         $profiledata["uid"] = -1;
117         $profiledata["nickname"] = $item["author-name"];
118         $profiledata["name"] = $item["author-name"];
119         $profiledata["picdate"] = "";
120         $profiledata["photo"] = $item["author-avatar"];
121         $profiledata["url"] = $item["author-link"];
122         $profiledata["network"] = $item["network"];
123
124         // Check for a repeated message
125         $skip = false;
126         $body = trim($item["body"]);
127
128         // Skip if it isn't a pure repeated messages
129         // Does it start with a share?
130         if (!$skip AND strpos($body, "[share") > 0)
131                 $skip = true;
132
133         // Does it end with a share?
134         if (!$skip AND (strlen($body) > (strrpos($body, "[/share]") + 8)))
135                 $skip = true;
136
137         if (!$skip) {
138                 $attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","$1",$body);
139                 // Skip if there is no shared message in there
140                 if ($body == $attributes)
141                         $skip = true;
142         }
143
144         if (!$skip) {
145                 $author = "";
146                 preg_match("/author='(.*?)'/ism", $attributes, $matches);
147                 if ($matches[1] != "")
148                         $profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
149
150                 preg_match('/author="(.*?)"/ism', $attributes, $matches);
151                 if ($matches[1] != "")
152                         $profiledata["name"] = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
153
154                 $profile = "";
155                 preg_match("/profile='(.*?)'/ism", $attributes, $matches);
156                 if ($matches[1] != "")
157                         $profiledata["url"] = $matches[1];
158
159                 preg_match('/profile="(.*?)"/ism', $attributes, $matches);
160                 if ($matches[1] != "")
161                         $profiledata["url"] = $matches[1];
162
163                 $avatar = "";
164                 preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
165                 if ($matches[1] != "")
166                         $profiledata["photo"] = $matches[1];
167
168                 preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
169                 if ($matches[1] != "")
170                         $profiledata["photo"] = $matches[1];
171
172                 $profiledata["nickname"] = $profiledata["name"];
173                 $profiledata["network"] = GetProfileUsername($profiledata["url"], "", false, true);
174
175                 $profiledata["address"] = "";
176                 $profiledata["about"] = "";
177         }
178
179         // Don't show details from Diaspora contacts if you don't follow the contact
180         $showdetails = ($profiledata["network"] != NETWORK_DIASPORA);
181
182         // Fetching further contact data from the contact table
183         $r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
184                 FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)",
185                 dbesc(normalise_link($profiledata["url"])), intval(local_user()), dbesc($item["network"]),
186                 intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
187         if (!count($r))
188                 $r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
189                         FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `rel` IN (%d, %d)",
190                         dbesc(normalise_link($profiledata["url"])), intval(local_user()),
191                         intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
192
193         if (count($r)) {
194                 $profiledata["name"] = $r[0]["name"];
195                 $profiledata["photo"] = $r[0]["photo"];
196                 $profiledata["nickname"] = $r[0]["nick"];
197                 $profiledata["addr"] = $r[0]["addr"];
198                 $profiledata["keywords"] = $r[0]["keywords"];
199                 $profiledata["network"] = $r[0]["network"];
200
201                 if (local_user() OR $showdetails) {
202                         $showdetails = true;
203                         $profiledata["address"] = $r[0]["location"];
204                         $profiledata["about"] = $r[0]["about"];
205                         $profiledata["gender"] = $r[0]["gender"];
206                 }
207         }
208
209         // Fetching profile data from global contacts
210         if ($profiledata["network"] != NETWORK_FEED) {
211                 $r = q("SELECT `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`, `network` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
212                 if (count($r)) {
213                         $profiledata["name"] = $r[0]["name"];
214                         $profiledata["photo"] = $r[0]["photo"];
215                         $profiledata["nickname"] = $r[0]["nick"];
216                         $profiledata["addr"] = $r[0]["addr"];
217                         $profiledata["network"] = $r[0]["network"];
218
219                         if ($r[0]["keywords"])
220                                 $profiledata["keywords"] = $r[0]["keywords"];
221
222                         if ($showdetails) {
223                                 if ($r[0]["location"])
224                                         $profiledata["address"] = $r[0]["location"];
225
226                                 if ($r[0]["about"])
227                                         $profiledata["about"] = $r[0]["about"];
228
229                                 if ($r[0]["gender"])
230                                         $profiledata["gender"] = $r[0]["gender"];
231                         }
232                 }
233         }
234
235         if (local_user()) {
236                 if (in_array($profiledata["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
237                         $profiledata["remoteconnect"] = $a->get_baseurl()."/follow?url=".urlencode($profiledata["url"]);
238         } elseif ($profiledata["network"] == NETWORK_DFRN) {
239                 $connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"]);
240                 $profiledata["remoteconnect"] = $connect;
241         }
242
243         return($profiledata);
244 }
245
246 function display_content(&$a, $update = 0) {
247
248         if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
249                 notice( t('Public access denied.') . EOL);
250                 return;
251         }
252
253         require_once('include/security.php');
254         require_once('include/conversation.php');
255         require_once('include/acl_selectors.php');
256
257
258         $o = '';
259
260         $a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'), array());
261
262
263         if($update) {
264                 $nick = $_REQUEST['nick'];
265         }
266         else {
267                 $nick = (($a->argc > 1) ? $a->argv[1] : '');
268         }
269
270         if($update) {
271                 $item_id = $_REQUEST['item_id'];
272                 $a->profile = array('uid' => intval($update), 'profile_uid' => intval($update));
273         }
274         else {
275                 $item_id = (($a->argc > 2) ? $a->argv[2] : 0);
276
277                 if ($a->argc == 2) {
278                         $nick = "";
279
280                         if (local_user()) {
281                                 $r = q("SELECT `id` FROM `item`
282                                         WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
283                                                 AND `guid` = '%s' AND `uid` = %d", dbesc($a->argv[1]), local_user());
284                                 if (count($r)) {
285                                         $item_id = $r[0]["id"];
286                                         $nick = $a->user["nickname"];
287                                 }
288                         }
289
290                         if ($nick == "") {
291                                 $r = q("SELECT `user`.`nickname`, `item`.`id` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
292                                         WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
293                                                 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''
294                                                 AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''
295                                                 AND NOT `item`.`private` AND NOT `user`.`hidewall`
296                                                 AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
297                                         //      AND NOT `item`.`private` AND `item`.`wall`
298                                 if (count($r)) {
299                                         $item_id = $r[0]["id"];
300                                         $nick = $r[0]["nickname"];
301                                 }
302                         }
303                         if ($nick == "") {
304                                 $r = q("SELECT `item`.`id` FROM `item`
305                                         WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
306                                                 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''
307                                                 AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''
308                                                 AND NOT `item`.`private` AND `item`.`uid` = 0
309                                                 AND `item`.`guid` = '%s'", dbesc($a->argv[1]));
310                                         //      AND NOT `item`.`private` AND `item`.`wall`
311                                 if (count($r)) {
312                                         $item_id = $r[0]["id"];
313                                 }
314                         }
315                 }
316         }
317
318         if ($item_id AND !is_numeric($item_id)) {
319                 $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
320                         dbesc($item_id), intval($a->profile['uid']));
321                 if ($r)
322                         $item_id = $r[0]["id"];
323                 else
324                         $item_id = false;
325         }
326
327         if (!$item_id) {
328                 $a->error = 404;
329                 notice(t('Item not found.').EOL);
330                 return;
331         }
332
333
334         $groups = array();
335
336         $contact = null;
337         $remote_contact = false;
338
339         $contact_id = 0;
340
341         if(is_array($_SESSION['remote'])) {
342                 foreach($_SESSION['remote'] as $v) {
343                         if($v['uid'] == $a->profile['uid']) {
344                                 $contact_id = $v['cid'];
345                                 break;
346                         }
347                 }
348         }
349
350         if($contact_id) {
351                 $groups = init_groups_visitor($contact_id);
352                 $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
353                         intval($contact_id),
354                         intval($a->profile['uid'])
355                 );
356                 if(count($r)) {
357                         $contact = $r[0];
358                         $remote_contact = true;
359                 }
360         }
361
362         if(! $remote_contact) {
363                 if(local_user()) {
364                         $contact_id = $_SESSION['cid'];
365                         $contact = $a->contact;
366                 }
367         }
368
369         $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
370                 intval($a->profile['uid'])
371         );
372         if(count($r))
373                 $a->page_contact = $r[0];
374
375         $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
376
377         if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
378                 notice( t('Access to this profile has been restricted.') . EOL);
379                 return;
380         }
381
382         // We need the editor here to be able to reshare an item.
383
384         if ($is_owner) {
385                 $x = array(
386                         'is_owner' => true,
387                         'allow_location' => $a->user['allow_location'],
388                         'default_location' => $a->user['default-location'],
389                         'nickname' => $a->user['nickname'],
390                         'lockstate' => ( (is_array($a->user)) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'),
391                         'acl' => populate_acl($a->user, true),
392                         'bang' => '',
393                         'visitor' => 'block',
394                         'profile_uid' => local_user(),
395                         'acl_data' => construct_acl_data($a, $a->user), // For non-Javascript ACL selector
396                 );
397                 $o .= status_editor($a,$x,0,true);
398         }
399
400         $sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
401
402         if($update) {
403
404                 $r = q("SELECT `id` FROM `item` WHERE `item`.`uid` = %d
405                         AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = %d)
406                         $sql_extra AND `unseen`",
407                         intval($a->profile['uid']),
408                         intval($item_id)
409                 );
410
411                 if(!$r)
412                         return '';
413         }
414
415         $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,  `item`.`network` AS `item_network`,
416                 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
417                 `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
418                 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
419                 FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
420                 AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
421                 WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted`
422                 AND NOT `item`.`moderated`
423                 AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = %d)
424                 $sql_extra
425                 ORDER BY `parent` DESC, `gravity` ASC, `id` ASC",
426                 intval($a->profile['uid']),
427                 intval($item_id)
428         );
429
430         if(!$r && local_user()) {
431                 // Check if this is another person's link to a post that we have
432                 $r = q("SELECT `item`.uri FROM `item`
433                         WHERE (`item`.`id` = %d OR `item`.`uri` = '%s')
434                         LIMIT 1",
435                         intval($item_id),
436                         dbesc($item_id)
437                 );
438                 if($r) {
439                         $item_uri = $r[0]['uri'];
440
441                         $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,  `item`.`network` AS `item_network`,
442                                 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
443                                 `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
444                                 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
445                                 FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
446                                 AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
447                                 WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted`
448                                 AND NOT `item`.`moderated`
449                                 AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `uri` = '%s' AND uid = %d)
450                                 ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
451                                 intval(local_user()),
452                                 dbesc($item_uri),
453                                 intval(local_user())
454                         );
455                 }
456         }
457
458
459         if($r) {
460
461                 if((local_user()) && (local_user() == $a->profile['uid'])) {
462                         $unseen = q("SELECT `id` FROM `item` WHERE `unseen` AND `parent` = %d",
463                                         intval($r[0]['parent']));
464
465                         if ($unseen)
466                                 q("UPDATE `item` SET `unseen` = 0
467                                         WHERE `parent` = %d AND `unseen`",
468                                         intval($r[0]['parent'])
469                                 );
470                 }
471
472                 $items = conv_sort($r,"`commented`");
473
474                 if(!$update)
475                         $o .= "<script> var netargs = '?f=&nick=" . $nick . "&item_id=" . $item_id . "'; </script>";
476                 $o .= conversation($a,$items,'display', $update);
477
478                 // Preparing the meta header
479                 require_once('include/bbcode.php');
480                 require_once("include/html2plain.php");
481                 $description = trim(html2plain(bbcode($r[0]["body"], false, false), 0, true));
482                 $title = trim(html2plain(bbcode($r[0]["title"], false, false), 0, true));
483                 $author_name = $r[0]["author-name"];
484
485                 $image = "";
486                 if ($image == "")
487                         $image = $r[0]["thumb"];
488
489                 if ($title == "")
490                         $title = $author_name;
491
492                 $description = htmlspecialchars($description, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
493                 $title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
494                 $author_name = htmlspecialchars($author_name, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
495
496                 //<meta name="keywords" content="">
497                 $a->page['htmlhead'] .= '<meta name="author" content="'.$author_name.'" />'."\n";
498                 $a->page['htmlhead'] .= '<meta name="title" content="'.$title.'" />'."\n";
499                 $a->page['htmlhead'] .= '<meta name="fulltitle" content="'.$title.'" />'."\n";
500                 $a->page['htmlhead'] .= '<meta name="description" content="'.$description.'" />'."\n";
501
502                 // Schema.org microdata
503                 $a->page['htmlhead'] .= '<meta itemprop="name" content="'.$title.'" />'."\n";
504                 $a->page['htmlhead'] .= '<meta itemprop="description" content="'.$description.'" />'."\n";
505                 $a->page['htmlhead'] .= '<meta itemprop="image" content="'.$image.'" />'."\n";
506                 $a->page['htmlhead'] .= '<meta itemprop="author" content="'.$author_name.'" />'."\n";
507
508                 // Twitter cards
509                 $a->page['htmlhead'] .= '<meta name="twitter:card" content="summary" />'."\n";
510                 $a->page['htmlhead'] .= '<meta name="twitter:title" content="'.$title.'" />'."\n";
511                 $a->page['htmlhead'] .= '<meta name="twitter:description" content="'.$description.'" />'."\n";
512                 $a->page['htmlhead'] .= '<meta name="twitter:image" content="'.$image.'" />'."\n";
513                 $a->page['htmlhead'] .= '<meta name="twitter:url" content="'.$r[0]["plink"].'" />'."\n";
514
515                 // Dublin Core
516                 $a->page['htmlhead'] .= '<meta name="DC.title" content="'.$title.'" />'."\n";
517                 $a->page['htmlhead'] .= '<meta name="DC.description" content="'.$description.'" />'."\n";
518
519                 // Open Graph
520                 $a->page['htmlhead'] .= '<meta property="og:type" content="website" />'."\n";
521                 $a->page['htmlhead'] .= '<meta property="og:title" content="'.$title.'" />'."\n";
522                 $a->page['htmlhead'] .= '<meta property="og:image" content="'.$image.'" />'."\n";
523                 $a->page['htmlhead'] .= '<meta property="og:url" content="'.$r[0]["plink"].'" />'."\n";
524                 $a->page['htmlhead'] .= '<meta property="og:description" content="'.$description.'" />'."\n";
525                 $a->page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n";
526                 // article:tag
527
528                 return $o;
529         }
530
531         $r = q("SELECT `id`,`deleted` FROM `item` WHERE `id` = '%s' OR `uri` = '%s' LIMIT 1",
532                 dbesc($item_id),
533                 dbesc($item_id)
534         );
535         if($r) {
536                 if($r[0]['deleted']) {
537                         notice( t('Item has been removed.') . EOL );
538                 }
539                 else {
540                         notice( t('Permission denied.') . EOL );
541                 }
542         }
543         else {
544                 notice( t('Item not found.') . EOL );
545         }
546
547         return $o;
548 }
549