mirror of
https://github.com/friendica/friendica
synced 2024-11-16 13:27:40 +01:00
Philipp Holzer
2c541afd47
- z_root() => $a->getBaseURL() - absurl() => removed because no usage - is_ajax() => $a->isAjax() - current_load() => System::currentLoad() - argc() => $a->argc - argv($x) => $a->getArgumentValue($x)
38 lines
697 B
PHP
38 lines
697 B
PHP
<?php
|
|
/**
|
|
* @file mod/viewsrc.php
|
|
*/
|
|
use Friendica\App;
|
|
use Friendica\Core\L10n;
|
|
use Friendica\Database\DBA;
|
|
use Friendica\Model\Item;
|
|
|
|
function viewsrc_content(App $a)
|
|
{
|
|
if (!local_user()) {
|
|
notice(L10n::t('Access denied.') . EOL);
|
|
return;
|
|
}
|
|
|
|
$o = '';
|
|
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
|
|
|
|
if (!$item_id) {
|
|
$a->error = 404;
|
|
notice(L10n::t('Item not found.') . EOL);
|
|
return;
|
|
}
|
|
|
|
$item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $item_id]);
|
|
|
|
if (DBA::isResult($item)) {
|
|
if ($a->isAjax()) {
|
|
echo str_replace("\n", '<br />', $item['body']);
|
|
killme();
|
|
} else {
|
|
$o .= str_replace("\n", '<br />', $item['body']);
|
|
}
|
|
}
|
|
return $o;
|
|
}
|