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