at('images/favicon.ico'); exit(0); } if ($_SERVER['REQUEST_URI'] == '/robots.txt') { $assetController = new AssetController(AppGlobal2::logger()); $assetController->at('/robots.txt'); exit(0); } header('Content-Type: text/html; charset=utf-8'); $application->handleRequest($_SERVER['REQUEST_URI']); if (AppGlobal2::logRequests() && !(StringUtils::startsWith($_SERVER['REQUEST_URI'], '/assets') || StringUtils::startsWith($_SERVER['REQUEST_URI'], '/photo'))) { $stopWatch->stop('URI:'); } } catch (Exception $e) { $mailer = AppGlobal2::emailSenderInstance(); $appName = AppGlobal2::getAppName(); $to = AppGlobal2::getIncidentMailRecipients(); $responseMessage = '500 Internal Server Error'; if ($e instanceof ButikException) { $responseMessage = $e->getHttpResponseMessage(); header('HTTP/1.0 ' . $e->getHttpResponseMessage()); } else { header('HTTP/1.0 ' . $responseMessage); } $logger->warn(ErrorFormatter::toExceptionString($e)); $env = AppGlobal2::getAppEnv(); $html = ErrorHandler::handleException($e, $isAjax, $appName, $responseMessage, $e->getCode()); if (strtoupper($env) != 'PRD') { echo $html[1]; } else { echo '

Es ist ein Fehler aufgetreten. Wir kümmern uns darum. Bitte versuchen Sie es später.

'; } $subject = $html[0]; AppGlobal2::logger()->debug($subject); if (strlen($subject) > 80) { $subject = substr($subject, 0, 77) . '...'; } if (AppGlobal2::noMailOn301()) { if ($e->getCode() == '301' && $e instanceof RouteException) { AppGlobal2::logger()->warn($e->getMessage() . '. Not sending incident mail.'); } else { $mailer->sendHtmlMail(str_replace(' ', '-', strtolower($appName)) . '-incidents@dublin-it.ch', $to, $appName . ': ' . $subject, $html[1]); } } else { $mailer->sendHtmlMail(str_replace(' ', '-', strtolower($appName)) . '-incidents@dublin-it.ch', $to, $appName . ': ' . $subject, $html[1]); } // If the api is down, send alarm sms if ($e instanceof ConnectionException) { if (strtoupper($env) == 'PRD') { $messge = 'API DOWN / ' . $e->getMessage() . ' / ' . AppGlobal2::getAppName() . ' / Get to thor.server.private and do as instructed there.'; $logger->critical('API down. Sending SMS'); $alertNumbers = AppGlobal2::smsAlertNumbers(); foreach ($alertNumbers as $number) { $postFields = [ 'id' => '101579', 'pass' => '1f89hie7', 'text' => $messge, 'nummer' => $number, 'gateway' => '20', 'absender' => 'BUTIK API', ]; $options = []; $options[CURLOPT_HEADER] = false; $options[CURLOPT_URL] = 'http://gateway.any-sms.biz/send_sms.php'; $options[CURLOPT_RETURNTRANSFER] = true; $options[CURLOPT_POSTFIELDS] = $postFields; $options[CURLOPT_SSL_VERIFYPEER] = false; $options[CURLOPT_TIMEOUT] = 10; $feed = curl_init(); curl_setopt_array($feed, $options); $json = curl_exec($feed); curl_close($feed); } } } }