Coding convention applied:

- added curly braces
- added space between if/foreach and brace
- avoided 2 return statements (true/false) by replacing them with just one
- added TODO for applying above to all findings

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2016-12-22 16:58:50 +01:00
parent 2325d81048
commit 9c81b4948e

View file

@ -1257,8 +1257,9 @@ function tag_deliver($uid,$item_id) {
$c = q("select name, url, thumb from contact where self = 1 and uid = %d limit 1", $c = q("select name, url, thumb from contact where self = 1 and uid = %d limit 1",
intval($u[0]['uid']) intval($u[0]['uid'])
); );
if (! count($c)) if (! count($c)) {
return; return;
}
// also reset all the privacy bits to the forum default permissions // also reset all the privacy bits to the forum default permissions
@ -1266,8 +1267,8 @@ function tag_deliver($uid,$item_id) {
$forum_mode = (($prvgroup) ? 2 : 1); $forum_mode = (($prvgroup) ? 2 : 1);
q("update item set wall = 1, origin = 1, forum_mode = %d, `owner-name` = '%s', `owner-link` = '%s', `owner-avatar` = '%s', q("UPDATE `item` SET `wall` = 1, `origin` = 1, `forum_mode` = %d, `owner-name` = '%s', `owner-link` = '%s', `owner-avatar` = '%s',
`private` = %d, `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' where id = %d", `private` = %d, `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `id` = %d",
intval($forum_mode), intval($forum_mode),
dbesc($c[0]['name']), dbesc($c[0]['name']),
dbesc($c[0]['url']), dbesc($c[0]['url']),
@ -1318,7 +1319,7 @@ function tgroup_check($uid,$item) {
$cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism',$item['body'],$matches,PREG_SET_ORDER); $cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism',$item['body'],$matches,PREG_SET_ORDER);
if ($cnt) { if ($cnt) {
foreach($matches as $mtch) { foreach ($matches as $mtch) {
if (link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) { if (link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) {
$mention = true; $mention = true;
logger('tgroup_check: mention found: ' . $mtch[2]); logger('tgroup_check: mention found: ' . $mtch[2]);
@ -1326,13 +1327,12 @@ function tgroup_check($uid,$item) {
} }
} }
if (! $mention) if (! $mention) {
return false; return false;
}
if ((! $community_page) && (! $prvgroup)) /// @TODO Combines both return statements into one
return false; return (($community_page) || ($prvgroup));
return true;
} }
/* /*
@ -1350,6 +1350,7 @@ function edited_timestamp_is_newer($existing, $update) {
if (!x($update,'edited') || !$update['edited']) { if (!x($update,'edited') || !$update['edited']) {
return false; return false;
} }
$existing_edited = datetime_convert('UTC', 'UTC', $existing['edited']); $existing_edited = datetime_convert('UTC', 'UTC', $existing['edited']);
$update_edited = datetime_convert('UTC', 'UTC', $update['edited']); $update_edited = datetime_convert('UTC', 'UTC', $update['edited']);
return (strcmp($existing_edited, $update_edited) < 0); return (strcmp($existing_edited, $update_edited) < 0);