mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-10 17:14:26 +02: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
|
@ -1770,8 +1770,8 @@ function admin_page_users(App $a)
|
|||
$e['page-flags-raw'] = $e['page-flags'];
|
||||
$e['page-flags'] = $page_types[$e['page-flags']];
|
||||
|
||||
$e['account-type-raw'] = ($e['page_flags_raw']==0) ? $e['account-type'] : -1;
|
||||
$e['account-type'] = ($e['page_flags_raw']==0) ? $account_types[$e['account-type']] : "";
|
||||
$e['account-type-raw'] = ($e['page_flags_raw'] == 0) ? $e['account-type'] : -1;
|
||||
$e['account-type'] = ($e['page_flags_raw'] == 0) ? $account_types[$e['account-type']] : "";
|
||||
|
||||
$e['register_date'] = Temporal::getRelativeDate($e['register_date']);
|
||||
$e['login_date'] = Temporal::getRelativeDate($e['login_date']);
|
||||
|
|
|
@ -63,17 +63,19 @@ function subthread_content(App $a) {
|
|||
WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
|
||||
intval($owner_uid)
|
||||
);
|
||||
if (DBM::is_result($r))
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
$owner = $r[0];
|
||||
}
|
||||
|
||||
if (! $owner) {
|
||||
logger('like: no owner');
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $remote_owner)
|
||||
if (! $remote_owner) {
|
||||
$remote_owner = $owner;
|
||||
|
||||
}
|
||||
|
||||
$contact = null;
|
||||
// This represents the person posting
|
||||
|
@ -85,8 +87,10 @@ function subthread_content(App $a) {
|
|||
intval($_SESSION['visitor_id']),
|
||||
intval($owner_uid)
|
||||
);
|
||||
if (DBM::is_result($r))
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
$contact = $r[0];
|
||||
}
|
||||
}
|
||||
if (! $contact) {
|
||||
return;
|
||||
|
|
|
@ -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