]> git.mxchange.org Git - friendica.git/blobdiff - mod/network.php
Rename App Methods
[friendica.git] / mod / network.php
index e029f1905cfdd9a37991a00bdff5433f26736a55..fb0093849e1ef4b618641c51bf33de99cb65c905 100644 (file)
@@ -302,7 +302,7 @@ function networkPager($a, $update)
                $itemspage_network = $a->force_max_items;
        }
 
-       $a->set_pager_itemspage($itemspage_network);
+       $a->setPagerItemsPage($itemspage_network);
 
        return sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
 }
@@ -418,9 +418,9 @@ function networkFlatView(App $a, $update = 0)
                        'allow_location' => $a->user['allow_location'],
                        'default_location' => $a->user['default-location'],
                        'nickname' => $a->user['nickname'],
-                       'lockstate' => (((is_array($a->user) &&
-                       ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) ||
-                       (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
+                       'lockstate' => (is_array($a->user) &&
+                       (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) ||
+                       strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
                        'default_perms' => ACL::getDefaultUserPermissions($a->user),
                        'acl' => ACL::getFullSelectorHTML($a->user, true),
                        'bang' => '',
@@ -496,6 +496,8 @@ function networkThreadedView(App $a, $update, $parent)
 
        $gid = 0;
 
+       $default_permissions = [];
+
        if ($a->argc > 1) {
                for ($x = 1; $x < $a->argc; $x ++) {
                        if (is_a_date_arg($a->argv[$x])) {
@@ -507,7 +509,7 @@ function networkThreadedView(App $a, $update, $parent)
                                }
                        } elseif (intval($a->argv[$x])) {
                                $gid = intval($a->argv[$x]);
-                               $def_acl = ['allow_gid' => '<' . $gid . '>'];
+                               $default_permissions = ['allow_gid' => '<' . $gid . '>'];
                        }
                }
        }
@@ -522,7 +524,7 @@ function networkThreadedView(App $a, $update, $parent)
        $nets  =        defaults($_GET, 'nets' , '');
 
        if ($cid) {
-               $def_acl = ['allow_cid' => '<' . intval($cid) . '>'];
+               $default_permissions = ['allow_cid' => '<' . intval($cid) . '>'];
        }
 
        if ($nets) {
@@ -533,7 +535,7 @@ function networkThreadedView(App $a, $update, $parent)
                        $str .= '<' . $rr['id'] . '>';
                }
                if (strlen($str)) {
-                       $def_acl = ['allow_cid' => $str];
+                       $default_permissions = ['allow_cid' => $str];
                }
        }
 
@@ -572,11 +574,11 @@ function networkThreadedView(App $a, $update, $parent)
                        'allow_location' => $a->user['allow_location'],
                        'default_location' => $a->user['default-location'],
                        'nickname' => $a->user['nickname'],
-                       'lockstate' => ((($gid) || ($cid) || ($nets) || (is_array($a->user) &&
-                       ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) ||
-                       (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
+                       'lockstate' => ($gid || $cid || $nets || (is_array($a->user) &&
+                       (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) ||
+                       strlen($a->user['deny_cid']) || strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'),
                        'default_perms' => ACL::getDefaultUserPermissions($a->user),
-                       'acl' => ACL::getFullSelectorHTML((($gid || $cid || $nets) ? $def_acl : $a->user), true),
+                       'acl' => ACL::getFullSelectorHTML($a->user, true, $default_permissions),
                        'bang' => (($gid || $cid || $nets) ? '!' : ''),
                        'visitor' => 'block',
                        'profile_uid' => local_user(),
@@ -719,7 +721,7 @@ function networkThreadedView(App $a, $update, $parent)
                        if ($last_received != '') {
                                $last_date = $last_received;
                                $sql_range .= sprintf(" AND $sql_table.`received` < '%s'", DBA::escape($last_received));
-                               $a->set_pager_page(1);
+                               $a->setPagerPage(1);
                                $pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
                        }
                        break;
@@ -727,7 +729,7 @@ function networkThreadedView(App $a, $update, $parent)
                        if ($last_commented != '') {
                                $last_date = $last_commented;
                                $sql_range .= sprintf(" AND $sql_table.`commented` < '%s'", DBA::escape($last_commented));
-                               $a->set_pager_page(1);
+                               $a->setPagerPage(1);
                                $pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
                        }
                        break;
@@ -735,14 +737,14 @@ function networkThreadedView(App $a, $update, $parent)
                        if ($last_created != '') {
                                $last_date = $last_created;
                                $sql_range .= sprintf(" AND $sql_table.`created` < '%s'", DBA::escape($last_created));
-                               $a->set_pager_page(1);
+                               $a->setPagerPage(1);
                                $pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
                        }
                        break;
                case 'id':
                        if (($last_id > 0) && ($sql_table == '`thread`')) {
                                $sql_range .= sprintf(" AND $sql_table.`iid` < '%s'", DBA::escape($last_id));
-                               $a->set_pager_page(1);
+                               $a->setPagerPage(1);
                                $pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
                        }
                        break;
@@ -769,7 +771,7 @@ function networkThreadedView(App $a, $update, $parent)
                        FROM `item` $sql_post_table
                        STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                                AND (NOT `contact`.`blocked` OR `contact`.`pending`)
-                               AND (`item`.`parent-uri` != `item`.`uri`
+                               AND (`item`.`gravity` != %d
                                        OR `contact`.`uid` = `item`.`uid` AND `contact`.`self`
                                        OR `contact`.`rel` IN (%d, %d) AND NOT `contact`.`readonly`)
                        LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = %d
@@ -778,6 +780,7 @@ function networkThreadedView(App $a, $update, $parent)
                        AND NOT `item`.`moderated` AND $sql_extra4
                        $sql_extra3 $sql_extra $sql_range $sql_nets
                        ORDER BY `order_date` DESC LIMIT 100",
+                       intval(GRAVITY_PARENT),
                        intval(Contact::SHARING),
                        intval(Contact::FRIEND),
                        intval(local_user()),
@@ -789,7 +792,7 @@ function networkThreadedView(App $a, $update, $parent)
                        STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
                                AND (NOT `contact`.`blocked` OR `contact`.`pending`)
                        STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
-                               AND (`item`.`parent-uri` != `item`.`uri`
+                               AND (`item`.`gravity` != %d
                                        OR `contact`.`uid` = `item`.`uid` AND `contact`.`self`
                                        OR `contact`.`rel` IN (%d, %d) AND NOT `contact`.`readonly`)
                        LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = %d
@@ -798,6 +801,7 @@ function networkThreadedView(App $a, $update, $parent)
                        AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
                        $sql_extra2 $sql_extra3 $sql_range $sql_extra $sql_nets
                        ORDER BY `order_date` DESC $pager_sql",
+                       intval(GRAVITY_PARENT),
                        intval(Contact::SHARING),
                        intval(Contact::FRIEND),
                        intval(local_user()),
@@ -806,7 +810,7 @@ function networkThreadedView(App $a, $update, $parent)
        }
 
        // Only show it when unfiltered (no groups, no networks, ...)
-       if (in_array($nets, ['', Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
+       if (in_array($nets, ['', Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
                if (DBA::isResult($r)) {
                        $top_limit = current($r)['order_date'];
                        $bottom_limit = end($r)['order_date'];