]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frio/theme.php
Update translation fie after adding a string
[friendica.git] / view / theme / frio / theme.php
index 2f6542d308238ec332e74e4bd7689dab02ec1459..a8db261848c70c37670a577f0b20ededbbc31c83 100644 (file)
@@ -55,10 +55,9 @@ function frio_install()
        Hook::register('item_photo_menu', 'view/theme/frio/theme.php', 'frio_item_photo_menu');
        Hook::register('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu');
        Hook::register('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav');
-       Hook::register('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup');
        Hook::register('display_item', 'view/theme/frio/theme.php', 'frio_display_item');
 
-       Logger::log('installed theme frio');
+       Logger::info('installed theme frio');
 }
 
 /**
@@ -200,9 +199,9 @@ function frio_remote_nav(App $a, array &$nav_info)
 
        // since $userinfo isn't available for the hook we write it to the nav array
        // this isn't optimal because the contact query will be done now twice
-       $fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl'];
-       if (local_user() && !empty($a->user['uid'])) {
-               $remoteUser = Contact::selectFirst($fields, ['uid' => $a->user['uid'], 'self' => true]);
+       $fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl', 'updated'];
+       if ($a->isLoggedIn()) {
+               $remoteUser = Contact::selectFirst($fields, ['uid' => $a->getLoggedInUserId(), 'self' => true]);
        } elseif (!local_user() && remote_user()) {
                $remoteUser = Contact::getById(remote_user(), $fields);
                $nav_info['nav']['remote'] = DI::l10n()->t('Guest');
@@ -226,7 +225,7 @@ function frio_remote_nav(App $a, array &$nav_info)
                $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
                $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
                $nav_info['nav']['usermenu'][] = [$server_url . '/photos/' . $remoteUser['nick'], DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
-               $nav_info['nav']['usermenu'][] = [$server_url . '/videos/' . $remoteUser['nick'], DI::l10n()->t('Videos'), '', DI::l10n()->t('Your videos')];
+               $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/media', DI::l10n()->t('Media'), '', DI::l10n()->t('Your postings with media')];
                $nav_info['nav']['usermenu'][] = [$server_url . '/events/', DI::l10n()->t('Events'), '', DI::l10n()->t('Your events')];
 
                // navbar links
@@ -239,81 +238,13 @@ function frio_remote_nav(App $a, array &$nav_info)
        }
 }
 
-/**
- * Search for contacts
- *
- * This function search for a users contacts. The code is copied from contact search
- * in /src/Module/Contact.php. With this function the contacts will permitted to acl_lookup()
- * and can grabbed as json. For this we use the type="r". This is usful to to let js
- * grab the contact data.
- * We use this to give the data to textcomplete and have a filter function at the
- * contact page.
- *
- * @param App $a The app data @TODO Unused
- * @param array $results The array with the originals from acl_lookup()
- */
-function frio_acl_lookup(App $a, &$results)
-{
-       $nets = !empty($_GET['nets']) ? Strings::escapeTags(trim($_GET['nets'])) : '';
-
-       // we introduce a new search type, r should do the same query like it's
-       // done in /src/Module/Contact.php for connections
-       if ($results['type'] !== 'r') {
-               return;
-       }
-
-       $sql_extra = '';
-       if ($results['search']) {
-               $search_txt = DBA::escape(Strings::protectSprintf(preg_quote($results['search'])));
-               $sql_extra .= " AND (`attag` LIKE '%%" . $search_txt . "%%' OR `name` LIKE '%%" . $search_txt . "%%' OR `nick` LIKE '%%" . $search_txt . "%%') ";
-       }
-
-       if ($nets) {
-               $sql_extra .= sprintf(" AND network = '%s' ", DBA::escape($nets));
-       }
-
-       $total = 0;
-       $r = q("SELECT COUNT(*) AS `total` FROM `contact`
-               WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `pending` $sql_extra ", intval($_SESSION['uid']));
-       if (DBA::isResult($r)) {
-               $total = $r[0]['total'];
-       }
-
-       $sql_extra3 = Widget::unavailableNetworks();
-
-       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `deleted` AND NOT `pending` $sql_extra $sql_extra3 ORDER BY `name` ASC LIMIT %d, %d ",
-               intval($_SESSION['uid']), intval($results['start']), intval($results['count'])
-       );
-
-       $contacts = [];
-
-       if (DBA::isResult($r)) {
-               foreach ($r as $rr) {
-                       $contacts[] = Module\Contact::getContactTemplateVars($rr);
-               }
-       }
-
-       $results['items'] = $contacts;
-       $results['tot'] = $total;
-}
-
-/**
- * Manipulate the data of the item
- *
- * At the moment we use this function to add some own stuff to the item menu
- *
- * @param App $a App $a The app data
- * @param array $arr Array with the item and the item actions<br>
- *     'item' => Array with item data<br>
- *     'output' => Array with item actions<br>
- */
 function frio_display_item(App $a, &$arr)
 {
        // Add follow to the item menu
        $followThread = [];
        if (
                local_user()
-               && local_user() == $arr['item']['uid']
+               && in_array($arr['item']['uid'], [0, local_user()])
                && $arr['item']['gravity'] == GRAVITY_PARENT
                && !$arr['item']['self']
                && !$arr['item']['mention']