mirror of
https://github.com/friendica/friendica
synced 2025-04-26 07:10:12 +00:00
Continued:
- avoided else() block which reduces code complexibility - used more x() - added curly braces - added known type-hints Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
parent
e0a07d5f27
commit
57e668d9e0
8 changed files with 48 additions and 38 deletions
|
@ -159,11 +159,13 @@ EOT;
|
|||
}
|
||||
|
||||
$term_objtype = ($item['resource-id'] ? TERM_OBJ_PHOTO : TERM_OBJ_POST);
|
||||
$t = q("SELECT count(tid) as tcount FROM term WHERE oid=%d AND term='%s'",
|
||||
intval($item['id']),
|
||||
dbesc($term)
|
||||
);
|
||||
if((! $blocktags) && $t[0]['tcount']==0 ) {
|
||||
|
||||
$t = q("SELECT count(tid) as tcount FROM term WHERE oid=%d AND term='%s'",
|
||||
intval($item['id']),
|
||||
dbesc($term)
|
||||
);
|
||||
|
||||
if ((!$blocktags) && $t[0]['tcount'] == 0 ) {
|
||||
q("INSERT INTO term (oid, otype, type, term, url, uid) VALUE (%d, %d, %d, '%s', '%s', %d)",
|
||||
intval($item['id']),
|
||||
$term_objtype,
|
||||
|
@ -176,26 +178,28 @@ EOT;
|
|||
|
||||
// if the original post is on this site, update it.
|
||||
|
||||
$r = q("select `tag`,`id`,`uid` from item where `origin` = 1 AND `uri` = '%s' LIMIT 1",
|
||||
$r = q("SELECT `tag`,`id`,`uid` FROM `item` WHERE `origin`=1 AND `uri`='%s' LIMIT 1",
|
||||
dbesc($item['uri'])
|
||||
);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
$x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1",
|
||||
$x = q("SELECT `blocktags` FROM `user` WHERE `uid`=%d LIMIT 1",
|
||||
intval($r[0]['uid'])
|
||||
);
|
||||
$t = q("SELECT count(tid) as tcount FROM term WHERE oid=%d AND term='%s'",
|
||||
$t = q("SELECT COUNT(`tid`) AS `tcount` FROM `term` WHERE `oid`=%d AND `term`='%s'",
|
||||
intval($r[0]['id']),
|
||||
dbesc($term)
|
||||
);
|
||||
if(count($x) && !$x[0]['blocktags'] && $t[0]['tcount']==0){
|
||||
q("INSERT INTO term (oid, otype, type, term, url, uid) VALUE (%d, %d, %d, '%s', '%s', %d)",
|
||||
intval($r[0]['id']),
|
||||
$term_objtype,
|
||||
TERM_HASHTAG,
|
||||
dbesc($term),
|
||||
dbesc(System::baseUrl() . '/search?tag=' . $term),
|
||||
intval($owner_uid)
|
||||
);
|
||||
|
||||
if (DBM::is_result($x) && !$x[0]['blocktags'] && $t[0]['tcount'] == 0){
|
||||
q("INSERT INTO term (`oid`, `otype`, `type`, `term`, `url`, `uid`) VALUE (%d, %d, %d, '%s', '%s', %d)",
|
||||
intval($r[0]['id']),
|
||||
$term_objtype,
|
||||
TERM_HASHTAG,
|
||||
dbesc($term),
|
||||
dbesc(System::baseUrl() . '/search?tag=' . $term),
|
||||
intval($owner_uid)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue