diff options
author | friendica <info@friendica.com> | 2012-11-13 14:37:02 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-11-13 14:37:02 -0800 |
commit | 34f8b06d4511592dc6bdb3cdae3b44d86e9825e6 (patch) | |
tree | 4b3768ce55ba7292ca566b7c6aeca33bb44b6ac8 /mod/viewsrc.php | |
parent | 67a7d440d9c8b37acfe2aa7c062f453680c45384 (diff) | |
download | volse-hubzilla-34f8b06d4511592dc6bdb3cdae3b44d86e9825e6.tar.gz volse-hubzilla-34f8b06d4511592dc6bdb3cdae3b44d86e9825e6.tar.bz2 volse-hubzilla-34f8b06d4511592dc6bdb3cdae3b44d86e9825e6.zip |
still a lot of files to bring up to date with new architecture - keep plugging away at them
Diffstat (limited to 'mod/viewsrc.php')
-rw-r--r-- | mod/viewsrc.php | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/mod/viewsrc.php b/mod/viewsrc.php index bc7f771d6..d728f96f5 100644 --- a/mod/viewsrc.php +++ b/mod/viewsrc.php @@ -3,34 +3,36 @@ function viewsrc_content(&$a) { + $o = ''; + + $item_id = ((argc() > 1) ? intval(argv(1)) : 0); + $raw_output = ((argc() > 2 && argv[2] === 'raw') ? true : false); + if(! local_user()) { - notice( t('Access denied.') . EOL); - return; + notice( t('Permission denied.') . EOL); } - $item_id = ((argc() > 1) ? intval(argv(1)) : 0); if(! $item_id) { $a->error = 404; notice( t('Item not found.') . EOL); - return; } - $r = q("SELECT `item`.`body` FROM `item` - WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 - and `item`.`moderated` = 0 - AND `item`.`id` = %d LIMIT 1", - intval(local_user()), - intval($item_id) - ); - - if(count($r)) { - $o = str_replace("\n",'<br />',$r[0]['body']); - if(is_ajax()) { - echo $o; - killme(); - } + if(local_user() && $item_id) { + $r = q("select body from item where item_restrict = 0 and uid = %d and id = %d limit 1", + intval(local_user()), + intval($item_id) + ); + + if($r) + $o = (($raw_output) ? $r[0]['body'] : str_replace("\n",'<br />',$r[0]['body'])); } + + if(is_ajax()) { + echo $o; + killme(); + } + return $o; } |