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