]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile.php
Replace old database queries with the new ones
[friendica.git] / mod / profile.php
index a7c39ab33f7ea88bc6200447d53b18dd84068d3f..49d6fe261d2b2ca761ca1406c7c958c7de2c8970 100644 (file)
@@ -6,6 +6,7 @@
 use Friendica\App;
 use Friendica\Content\Nav;
 use Friendica\Content\Widget;
+use Friendica\Core\ACL;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
@@ -74,6 +75,7 @@ function profile_init(App $a)
        }
 
        $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n";
+       $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which . '" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
@@ -116,10 +118,8 @@ function profile_content(App $a, $update = 0)
                return Login::form();
        }
 
-       require_once 'include/bbcode.php';
        require_once 'include/security.php';
        require_once 'include/conversation.php';
-       require_once 'include/acl_selectors.php';
        require_once 'include/items.php';
 
        $groups = [];
@@ -192,7 +192,7 @@ function profile_content(App $a, $update = 0)
                $o .= Widget::commonFriendsVisitor($a->profile['profile_uid']);
 
                if (x($_SESSION, 'new_member') && $is_owner) {
-                       $o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . L10n::t('Tips for New Members') . '</b></a>' . EOL;
+                       $o .= '<div id="newmember-tips"><a href="newmember"><b>' . L10n::t('Tips for New Members') . '</b></a></div>';
                }
 
                $commpage = $a->profile['page-flags'] == PAGE_COMMUNITY;
@@ -214,7 +214,7 @@ function profile_content(App $a, $update = 0)
                                                || strlen($a->user['deny_cid'])
                                                || strlen($a->user['deny_gid'])
                                        ) ? 'lock' : 'unlock',
-                               'acl' => $is_owner ? populate_acl($a->user, true) : '',
+                               'acl' => $is_owner ? ACL::getFullSelectorHTML($a->user, true) : '',
                                'bang' => '',
                                'visitor' => $is_owner || $commvisitor ? 'block' : 'none',
                                'profile_uid' => $a->profile['profile_uid'],
@@ -337,23 +337,16 @@ function profile_content(App $a, $update = 0)
                        $parents_arr[] = $rr['item_id'];
                }
 
-               $parents_str = implode(', ', $parents_arr);
-
-               $items = q(item_query() . " AND `item`.`uid` = %d
-                       AND `item`.`parent` IN (%s)
-                       $sql_extra ",
-                       intval($a->profile['profile_uid']),
-                       dbesc($parents_str)
-               );
-
-               $items = conv_sort($items, 'created');
+               $condition = ['uid' => $a->profile['profile_uid'], 'parent' => $parents_arr];
+               $result = Item::selectForUser($a->profile['profile_uid'], [], $condition);
+               $items = conv_sort(dba::inArray($result), 'created');
        } else {
                $items = [];
        }
 
        if ($is_owner && !$update && !Config::get('theme', 'hide_eventlist')) {
                $o .= Profile::getBirthdays();
-               $o .= Profile::getEvents();
+               $o .= Profile::getEventsReminderHTML();
        }
 
 
@@ -365,7 +358,7 @@ function profile_content(App $a, $update = 0)
                }
        }
 
-       $o .= conversation($a, $items, 'profile', $update);
+       $o .= conversation($a, $items, 'profile', $update, false, 'commented', local_user());
 
        if (!$update) {
                $o .= alt_pager($a, count($items));