]> git.mxchange.org Git - friendica.git/commitdiff
Coding convention applied:
authorRoland Häder <roland@mxchange.org>
Thu, 22 Dec 2016 15:58:50 +0000 (16:58 +0100)
committerRoland Häder <roland@mxchange.org>
Thu, 22 Dec 2016 15:59:43 +0000 (16:59 +0100)
- 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>
include/items.php

index e91c7088ab297da633a1546b8dc88cc7f09d1564..10afc28c0e07c4633e6c6183ff844627e9d557a7 100644 (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",
                intval($u[0]['uid'])
        );
-       if (! count($c))
+       if (! count($c)) {
                return;
+       }
 
        // 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);
 
-       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",
+       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",
                intval($forum_mode),
                dbesc($c[0]['name']),
                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);
        if ($cnt) {
-               foreach($matches as $mtch) {
+               foreach ($matches as $mtch) {
                        if (link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) {
                                $mention = true;
                                logger('tgroup_check: mention found: ' . $mtch[2]);
@@ -1326,13 +1327,12 @@ function tgroup_check($uid,$item) {
                }
        }
 
-       if (! $mention)
-               return false;
-
-       if ((! $community_page) && (! $prvgroup))
+       if (! $mention) {
                return false;
+       }
 
-       return true;
+       /// @TODO Combines both return statements into one
+       return (($community_page) || ($prvgroup));
 }
 
 /*
@@ -1344,15 +1344,16 @@ function tgroup_check($uid,$item) {
   assumes the update has been seen before and should be ignored.
   */
 function edited_timestamp_is_newer($existing, $update) {
-    if (!x($existing,'edited') || !$existing['edited']) {
-       return true;
-    }
-    if (!x($update,'edited') || !$update['edited']) {
-       return false;
-    }
-    $existing_edited = datetime_convert('UTC', 'UTC', $existing['edited']);
-    $update_edited = datetime_convert('UTC', 'UTC', $update['edited']);
-    return (strcmp($existing_edited, $update_edited) < 0);
+       if (!x($existing,'edited') || !$existing['edited']) {
+               return true;
+       }
+       if (!x($update,'edited') || !$update['edited']) {
+               return false;
+       }
+
+       $existing_edited = datetime_convert('UTC', 'UTC', $existing['edited']);
+       $update_edited = datetime_convert('UTC', 'UTC', $update['edited']);
+       return (strcmp($existing_edited, $update_edited) < 0);
 }
 
 /**