mirror of
https://github.com/friendica/friendica
synced 2024-11-10 07:42:53 +00:00
Add support for profile_*_color in API
This commit is contained in:
parent
6b622fa9e4
commit
3e9bc61bbf
1 changed files with 36 additions and 0 deletions
|
@ -10,6 +10,7 @@ use Friendica\Content\Feature;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -779,6 +780,41 @@ function api_get_user(App $a, $contact_id = null)
|
|||
'network' => $uinfo[0]['network'],
|
||||
);
|
||||
|
||||
// If this is a local user and it uses Frio, we can get its color preferences.
|
||||
if ($ret['self']) {
|
||||
$r = dba::p(
|
||||
"select theme from user where uid = ? limit 1",
|
||||
$ret['uid']
|
||||
);
|
||||
$theme_info = $r->fetch();
|
||||
if ($theme_info['theme'] === 'frio') {
|
||||
$schema = PConfig::get($ret['uid'], 'frio', 'schema');
|
||||
if (($schema) && ($schema != '---')) {
|
||||
if (file_exists('view/theme/frio/schema/'.$schema.'.php')) {
|
||||
$schemefile = 'view/theme/frio/schema/'.$schema.'.php';
|
||||
require_once($schemefile);
|
||||
}
|
||||
} else {
|
||||
$nav_bg = PConfig::get($ret['uid'], 'frio', 'nav_bg');
|
||||
$link_color = PConfig::get($ret['uid'], 'frio', 'link_color');
|
||||
$bgcolor = PConfig::get($ret['uid'], 'frio', 'background_color');
|
||||
}
|
||||
if (!$nav_bg) {
|
||||
$nav_bg = "#708fa0";
|
||||
}
|
||||
if (!$link_color) {
|
||||
$link_color = "#6fdbe8";
|
||||
}
|
||||
if (!$bgcolor) {
|
||||
$bgcolor = "#ededed";
|
||||
}
|
||||
|
||||
$ret['profile_sidebar_fill_color'] = str_replace('#', '', $nav_bg);
|
||||
$ret['profile_link_color'] = str_replace('#', '', $link_color);
|
||||
$ret['profile_background_color'] = str_replace('#', '', $bgcolor);
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue