]> git.mxchange.org Git - friendica.git/blobdiff - src/BaseModule.php
Merge pull request #9345 from annando/issue-9344
[friendica.git] / src / BaseModule.php
index 0e0fedb80c35925b4809595287c88254ae2a4c12..c1f35533be1e5651f2cc45a2a0eb0c16a068c26b 100644 (file)
@@ -140,7 +140,7 @@ abstract class BaseModule
                        return false;
                }
 
-               $sec_hash = hash('whirlpool', $a->user['guid'] . $a->user['prvkey'] . session_id() . $x[0] . $typename);
+               $sec_hash = hash('whirlpool', ($a->user['guid'] ?? '') . ($a->user['prvkey'] ?? '') . session_id() . $x[0] . $typename);
 
                return ($sec_hash == $x[1]);
        }
@@ -171,4 +171,40 @@ abstract class BaseModule
                        throw new \Friendica\Network\HTTPException\ForbiddenException();
                }
        }
+
+       protected static function getContactFilterTabs(string $baseUrl, string $current, bool $displayCommonTab)
+       {
+               $tabs = [
+                       [
+                               'label' => DI::l10n()->t('All contacts'),
+                               'url'   => $baseUrl . '/contacts',
+                               'sel'   => !$current || $current == 'all' ? 'active' : '',
+                       ],
+                       [
+                               'label' => DI::l10n()->t('Followers'),
+                               'url'   => $baseUrl . '/contacts/followers',
+                               'sel'   => $current == 'followers' ? 'active' : '',
+                       ],
+                       [
+                               'label' => DI::l10n()->t('Following'),
+                               'url'   => $baseUrl . '/contacts/following',
+                               'sel'   => $current == 'following' ? 'active' : '',
+                       ],
+                       [
+                               'label' => DI::l10n()->t('Mutual friends'),
+                               'url'   => $baseUrl . '/contacts/mutuals',
+                               'sel'   => $current == 'mutuals' ? 'active' : '',
+                       ],
+               ];
+
+               if ($displayCommonTab) {
+                       $tabs[] = [
+                               'label' => DI::l10n()->t('Common'),
+                               'url'   => $baseUrl . '/contacts/common',
+                               'sel'   => $current == 'common' ? 'active' : '',
+                       ];
+               }
+
+               return $tabs;
+       }
 }