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 30642756e5
commit 8db0be09b8
1 changed files with 19 additions and 18 deletions

View File

@ -1260,8 +1260,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
@ -1269,8 +1270,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']),
@ -1322,7 +1323,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]);
@ -1330,13 +1331,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;
} }
/* /*
@ -1348,15 +1348,16 @@ function tgroup_check($uid,$item) {
assumes the update has been seen before and should be ignored. assumes the update has been seen before and should be ignored.
*/ */
function edited_timestamp_is_newer($existing, $update) { function edited_timestamp_is_newer($existing, $update) {
if (!x($existing,'edited') || !$existing['edited']) { if (!x($existing,'edited') || !$existing['edited']) {
return true; return true;
} }
if (!x($update,'edited') || !$update['edited']) { if (!x($update,'edited') || !$update['edited']) {
return false; return false;
} }
$existing_edited = datetime_convert('UTC', 'UTC', $existing['edited']);
$update_edited = datetime_convert('UTC', 'UTC', $update['edited']); $existing_edited = datetime_convert('UTC', 'UTC', $existing['edited']);
return (strcmp($existing_edited, $update_edited) < 0); $update_edited = datetime_convert('UTC', 'UTC', $update['edited']);
return (strcmp($existing_edited, $update_edited) < 0);
} }
/** /**