Merge pull request #621 from annando/acf_abstraction

advancedcontentfilter: Abstraction for the item call
pull/623/head
Hypolite Petovan 2018-06-15 19:30:35 -04:00 committed by GitHub
commit 49558d7d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -42,6 +42,7 @@ use Friendica\Network\HTTPException;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\ExpressionLanguage; use Symfony\Component\ExpressionLanguage;
use Friendica\Model\Item;
require_once 'boot.php'; require_once 'boot.php';
require_once 'include/conversation.php'; require_once 'include/conversation.php';
@ -402,7 +403,9 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques
throw new HTTPException\BadRequestException(L10n::t('Missing argument: guid.')); throw new HTTPException\BadRequestException(L10n::t('Missing argument: guid.'));
} }
$item = dba::fetch_first(item_query() . " AND `item`.`guid` = ? AND (`item`.`uid` = ? OR `item`.`uid` = 0) ORDER BY `item`.`uid` DESC", $args['guid'], local_user()); $condition = ["`guid` = ? AND (`uid` = ? OR `uid` = 0)", $args['guid'], local_user()];
$params = ['order' => ['uid' => true]];
$item = Item::selectFirst(local_user(), [], $condition, $params);
if (!\Friendica\Database\DBM::is_result($item)) { if (!\Friendica\Database\DBM::is_result($item)) {
throw new HTTPException\NotFoundException(L10n::t('Unknown post with guid: %s', $args['guid'])); throw new HTTPException\NotFoundException(L10n::t('Unknown post with guid: %s', $args['guid']));