'; print_r($avatar); echo ''; return 'https://cdn.id.byecorps.com/' . $avatar['path']; } return 'https://cdn.id.byecorps.com/profile/default.png'; } function set_user_language(string $lang_code, string $id="9999999"): void { $_SESSION['lang'] = $lang_code; if ($id == DEMO_USER) { return; } db_execute( 'UPDATE accounts SET language = ? WHERE id = ?', [$lang_code, $id] ); } function requires_auth($redirect = '/auth/login') { global $path_raw; if ($_SESSION['auth']) { return true; } http_response_code(307); header('Location: '.$redirect.'?callback='.urlencode($path_raw)); exit(); } function requires_admin() { global $user; if ($user['is_admin']) { return true; } return false; }