Merge pull request #6621 from annando/notice
Fix for possible notice "Undefined offset: 0"
This commit is contained in:
commit
d65b29af57
1 changed files with 12 additions and 11 deletions
|
@ -28,20 +28,21 @@ function friendica_init(App $a)
|
||||||
$register_policy = $register_policies[$register_policy_int];
|
$register_policy = $register_policies[$register_policy_int];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_extra = '';
|
$condition = [];
|
||||||
if (Config::get('config', 'admin_nickname') !== null) {
|
$admin = false;
|
||||||
$sql_extra = sprintf(" AND `nickname` = '%s' ", DBA::escape(Config::get('config', 'admin_nickname')));
|
if (!empty(Config::get('config', 'admin_nickname'))) {
|
||||||
|
$condition['nickname'] = Config::get('config', 'admin_nickname');
|
||||||
}
|
}
|
||||||
if (!empty(Config::get('config', 'admin_email'))) {
|
if (!empty(Config::get('config', 'admin_email'))) {
|
||||||
$adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
|
$adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
|
||||||
|
$condition['email'] = $adminlist[0];
|
||||||
$r = q("SELECT `username`, `nickname` FROM `user` WHERE `email` = '%s' $sql_extra", DBA::escape($adminlist[0]));
|
$administrator = DBA::selectFirst('user', ['username', 'nickname'], $condition);
|
||||||
|
if (DBA::isResult($administrator)) {
|
||||||
$admin = [
|
$admin = [
|
||||||
'name' => $r[0]['username'],
|
'name' => $administrator['username'],
|
||||||
'profile'=> System::baseUrl() . '/profile/' . $r[0]['nickname'],
|
'profile'=> System::baseUrl() . '/profile/' . $administrator['nickname'],
|
||||||
];
|
];
|
||||||
} else {
|
}
|
||||||
$admin = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$visible_addons = Addon::getVisibleList();
|
$visible_addons = Addon::getVisibleList();
|
||||||
|
|
Loading…
Reference in a new issue