]> git.mxchange.org Git - friendica.git/blob - mod/viewsrc.php
Remove include/oembed and mod/oembed
[friendica.git] / mod / viewsrc.php
1 <?php
2
3 use Friendica\App;
4 use Friendica\Database\DBM;
5
6 function viewsrc_content(App $a) {
7
8         if (! local_user()) {
9                 notice( t('Access denied.') . EOL);
10                 return;
11         }
12
13         $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
14
15         if(! $item_id) {
16                 $a->error = 404;
17                 notice( t('Item not found.') . EOL);
18                 return;
19         }
20
21         $r = q("SELECT `item`.`body` FROM `item`
22                 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
23                 and `item`.`moderated` = 0
24                 AND `item`.`id` = '%s' LIMIT 1",
25                 intval(local_user()),
26                 dbesc($item_id)
27         );
28
29         if (DBM::is_result($r))
30                 if(is_ajax()) {
31                         echo str_replace("\n",'<br />',$r[0]['body']);
32                         killme();
33                 } else {
34                         $o .= str_replace("\n",'<br />',$r[0]['body']);
35                 }
36         return $o;
37 }
38