use Friendica\Module;
use Friendica\Util\Strings;
+const FRIO_SCHEME_ACCENT_BLUE = '#1e87c2';
+const FRIO_SCHEME_ACCENT_RED = '#b50404';
+const FRIO_SCHEME_ACCENT_PURPLE = '#a54bad';
+const FRIO_SCHEME_ACCENT_GREEN = '#218f39';
+const FRIO_SCHEME_ACCENT_PINK = '#d900a9';
+
function frio_init(App $a)
{
global $frio;
* @param App $a The App class
* @param array $nav The original nav menu
*/
-function frio_remote_nav($a, &$nav)
+function frio_remote_nav(App $a, array &$nav)
{
// get the homelink from $_XSESSION
$homelink = Model\Profile::getMyURL();
// 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::getById($a->user['uid'], ['id', 'url', 'avatar', 'micro', 'name', 'nick']);
- $remoteUser['name'] = $a->user['username'];
+ $remoteUser = Contact::selectFirst($fields, ['uid' => $a->user['uid'], 'self' => true]);
} elseif (!local_user() && remote_user()) {
- $remoteUser = Contact::getById(remote_user(), ['id', 'url', 'avatar', 'micro', 'name', 'nick']);
+ $remoteUser = Contact::getById(remote_user(), $fields);
$nav['remote'] = DI::l10n()->t('Guest');
} elseif (Model\Profile::getMyURL()) {
- $remoteUser = Contact::getByURL($homelink, ['id', 'url', 'avatar', 'micro', 'name', 'nick']);
+ $remoteUser = Contact::getByURL($homelink, null, $fields);
$nav['remote'] = DI::l10n()->t('Visitor');
} else {
$remoteUser = null;
*/
function frio_display_item(App $a, &$arr)
{
- // Add subthread to the item menu
- $subthread = [];
+ // Add follow to the item menu
+ $followThread = [];
if (
local_user()
&& local_user() == $arr['item']['uid']
&& $arr['item']['gravity'] == GRAVITY_PARENT
- && !$arr['item']['self'])
- {
- $subthread = [
+ && !$arr['item']['self']
+ && !$arr['item']['mention']
+ ) {
+ $followThread = [
'menu' => 'follow_thread',
'title' => DI::l10n()->t('Follow Thread'),
- 'action' => 'dosubthread(' . $arr['item']['id'] . ');',
+ 'action' => 'doFollowThread(' . $arr['item']['id'] . ');',
'href' => '#'
];
}
- $arr['output']['subthread'] = $subthread;
-}
-
-/**
- * @param int|null $uid
- * @return string
- * @see \Friendica\Core\Theme::getBackgroundColor()
- */
-function frio_get_background_color(int $uid = null)
-{
- $background_color = DI::config()->get('frio', 'background_color') ?: '#ededed';
-
- if ($uid) {
- $background_color = DI::pConfig()->get($uid, 'frio', 'background_color') ?: $background_color;
- }
-
- $scheme = DI::config()->get('frio', 'scheme', DI::config()->get('frio', 'schema'));
- $scheme = Strings::sanitizeFilePathItem($scheme);
-
- if ($scheme && ($scheme != '---') && file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
- $schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
- require_once $schemefile;
- }
-
- return $background_color;
-}
-
-/**
- * @param int|null $uid
- * @return string
- * @see \Friendica\Core\Theme::getThemeColor()
- */
-function frio_get_theme_color(int $uid = null)
-{
- $nav_bg = DI::config()->get('frio', 'nav_bg') ?: '#708fa0';
-
- if ($uid) {
- $nav_bg = DI::pConfig()->get($uid, 'frio', 'background_color') ?: $nav_bg;
- }
-
- $scheme = DI::config()->get('frio', 'scheme', DI::config()->get('frio', 'schema'));
- $scheme = Strings::sanitizeFilePathItem($scheme);
-
- if ($scheme && ($scheme != '---') && file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
- $schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
- require_once $schemefile;
- }
-
- return $nav_bg;
+ $arr['output']['follow_thread'] = $followThread;
}