Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

HHVM/Hack Typing Error Fixes #450

Merged
merged 2 commits into from Feb 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2852,7 +2852,8 @@ class={$highlighted_color}
if (count($failures) > 0) {
$failures_tbody = <tbody></tbody>;
foreach ($failures as $failure) {
if (!Level::genCheckStatus($failure->getLevelId())) {
$check_status = await Level::genCheckStatus($failure->getLevelId());
if (!$check_status) {
continue;
}
$level = await Level::gen($failure->getLevelId());
Expand Down
6 changes: 4 additions & 2 deletions src/controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ abstract protected function genRenderBody(string $page): Awaitable<:xhp>;
// TODO: Potential LFI - Review how to do internationalization better
$document_root = must_have_string(Utils::getSERVER(), 'DOCUMENT_ROOT');
$language_style = '';
if (file_exists($document_root. '/static/css/locals/' .$language. '/style.css')) {
$language_style = 'static/css/locals/' .$language. '/style.css';
if (file_exists(
$document_root.'/static/css/locals/'.$language.'/style.css',
)) {
$language_style = 'static/css/locals/'.$language.'/style.css';
}
return
<x:doctype>
Expand Down
10 changes: 7 additions & 3 deletions src/controllers/ajax/IndexAjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ protected function getActions(): array<string> {
array<string> $names,
array<string> $emails,
): Awaitable<string> {
$ldap_password = $password;

// Check if registration is enabled
$registration = await Configuration::gen('registration');
if ($registration->getValue() === '0') {
Expand Down Expand Up @@ -144,7 +146,6 @@ protected function getActions(): array<string> {
// Use randomly generated password for local account for LDAP users
// This will help avoid leaking users ldap passwords if the server's database
// is compromised.
$ldap_password = $password;
$password = gmp_strval(
gmp_init(bin2hex(openssl_random_pseudo_bytes(16)), 16),
62,
Expand Down Expand Up @@ -189,6 +190,7 @@ protected function getActions(): array<string> {
// Verify that this team name is not created yet
$team_exists = await Team::genTeamExist($shortname);
if (!$team_exists) {
invariant(is_string($password), "Expected password to be a string");
$password_hash = Team::generateHash($password);
$team_id =
await Team::genCreate($shortname, $password_hash, $logo_name);
Expand All @@ -205,9 +207,11 @@ protected function getActions(): array<string> {
await Token::genUse($token, $team_id);
}
// Login the team
if ($ldap->getValue() === '1')
return await $this->genLoginTeam($team_id, $ldap_password); else
if ($ldap->getValue() === '1') {
return await $this->genLoginTeam($team_id, $ldap_password);
} else {
return await $this->genLoginTeam($team_id, $password);
}
} else {
return Utils::error_response('Registration failed', 'registration');
}
Expand Down
3 changes: 2 additions & 1 deletion src/models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ private static function categoryFromRow(Map<string, string> $row): Category {
if (!$mc_result || count($mc_result) === 0 || $refresh) {
$db = await self::genDb();
$categories = array();
$result = await $db->queryf('SELECT * FROM categories ORDER BY category ASC');
$result =
await $db->queryf('SELECT * FROM categories ORDER BY category ASC');
foreach ($result->mapRows() as $row) {
$categories[] = self::categoryFromRow($row);
}
Expand Down