setHost(config('mail.smtp.server')) ->setPort(config('mail.smtp.port')); if (config('mail.smtp.secure')) { $transport->setEncryption(config('mail.smtp.secure')); } if (config('mail.smtp.auth')) { $transport->setUsername(config('mail.smtp.username')) ->setPassword(config('mail.smtp.password')); } $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance($subject) ->setFrom([config('mail.smtp.from') => config('mail.smtp.name')]) ->setBcc($to) ->setBody($body); return $mailer->send($message); } function rel2abs($rel, $base) : string { // return if already absolute URL if (parse_url($rel, PHP_URL_SCHEME) != '') { return $rel; } // queries and anchors if ($rel[0] == '#' || $rel[0] == '?') { return $base.$rel; } // parse base URL and convert to local variables: // $scheme, $host, $path extract(parse_url($base)); // remove non-directory element from path $path = preg_replace('#/[^/]*$#', '', $path); // destroy path if relative url points to root if ($rel[0] == '/') { $path = ''; } // dirty absolute URL $abs = "$host$path/$rel"; // replace '//' or '/./' or '/foo/../' with '/' $re = ['#(/\.?/)#', '#/(?!\.\.)[^/]+/\.\./#']; for ($n = 1; $n > 0; $abs = preg_replace($re, '/', $abs, -1, $n)) { } // absolute URL is ready! return $scheme.'://'.$abs; } function checkMaintenance() { if (config('general.maintenance')) { http_response_code(503); return view('errors/503'); } } function auth3DS() { ConsoleAuth::check3DS(); } function authWiiU() { ConsoleAuth::checkWiiU(); } function checkConsoleAuth() { CurrentSession::authByConsole(ConsoleAuth::$consoleId); Template::vars([ '_console' => ConsoleAuth::$paramPack, 'user' => CurrentSession::$user, 'language' => Translation::getIsoLanguage(CurrentSession::$user->language) ]); } function hashid($items) { return Hashid::encode($items); } function dehashid($hash) { return Hashid::decode($hash); } function __(string $key, array $replace = []) { return Translation::get($key, $replace); }