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