still a lot of files to bring up to date with new architecture - keep plugging away at them

This commit is contained in:
friendica
2012-11-13 14:37:02 -08:00
parent 67a7d440d9
commit 34f8b06d45
3 changed files with 35 additions and 33 deletions

View File

@@ -3,34 +3,36 @@
function viewsrc_content(&$a) {
if(! local_user()) {
notice( t('Access denied.') . EOL);
return;
}
$o = '';
$item_id = ((argc() > 1) ? intval(argv(1)) : 0);
$raw_output = ((argc() > 2 && argv[2] === 'raw') ? true : false);
if(! local_user()) {
notice( t('Permission denied.') . EOL);
}
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(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(count($r)) {
$o = str_replace("\n",'<br />',$r[0]['body']);
if(is_ajax()) {
echo $o;
killme();
}
if($r)
$o = (($raw_output) ? $r[0]['body'] : str_replace("\n",'<br />',$r[0]['body']));
}
if(is_ajax()) {
echo $o;
killme();
}
return $o;
}