mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 03:25:15 +02:00
Restructured "dba::exists" function
This commit is contained in:
parent
b14b44e8a8
commit
1d8c91c478
9 changed files with 33 additions and 35 deletions
|
@ -292,8 +292,8 @@ function display_content(App $a, $update = 0) {
|
|||
}
|
||||
|
||||
// We are displaying an "alternate" link if that post was public. See issue 2864
|
||||
$items = dba::select('item', array('id'), array('id' => $item_id, 'private' => false, 'wall' => true));
|
||||
if (dbm::is_result($items)) {
|
||||
$is_public = dba::exists('item', array('id' => $item_id, 'private' => false, 'wall' => true));
|
||||
if ($is_public) {
|
||||
$alternate = App::get_baseurl().'/display/'.$nick.'/'.$item_id.'.atom';
|
||||
} else {
|
||||
$alternate = '';
|
||||
|
@ -369,14 +369,14 @@ function display_content(App $a, $update = 0) {
|
|||
$sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
|
||||
|
||||
if ($update) {
|
||||
$r = dba::exists("SELECT `id` FROM `item` WHERE `item`.`uid` = ?
|
||||
$r = dba::p("SELECT `id` FROM `item` WHERE `item`.`uid` = ?
|
||||
AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = ?)
|
||||
$sql_extra AND `unseen`",
|
||||
$a->profile['uid'],
|
||||
$item_id
|
||||
);
|
||||
|
||||
if (!$r) {
|
||||
if (dba::num_rows($r) == 0) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -793,9 +793,9 @@ function network_content(App $a, $update = 0) {
|
|||
|
||||
|
||||
if (!$group && !$cid && !$star) {
|
||||
$unseen = dba::select('item', array('id'), array('unseen' => true, 'uid' => local_user()), array('limit' => 1));
|
||||
$unseen = dba::exists('item', array('unseen' => true, 'uid' => local_user()));
|
||||
|
||||
if (dbm::is_result($unseen)) {
|
||||
if ($unseen) {
|
||||
$r = dba::update('item', array('unseen' => false), array('uid' => local_user(), 'unseen' => true));
|
||||
}
|
||||
} elseif ($update_unseen) {
|
||||
|
|
|
@ -334,9 +334,8 @@ function profile_content(App $a, $update = 0) {
|
|||
|
||||
|
||||
if ($is_owner) {
|
||||
$unseen = dba::select('item', array('id'), array('wall' => true, 'unseen' => true, 'uid' => local_user()),
|
||||
array('limit' => 1));
|
||||
if (dbm::is_result($unseen)) {
|
||||
$unseen = dba::exists('item', array('wall' => true, 'unseen' => true, 'uid' => local_user()));
|
||||
if ($unseen) {
|
||||
$r = dba::update('item', array('unseen' => false),
|
||||
array('wall' => true, 'unseen' => true, 'uid' => local_user()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue