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 error_handler($errno, $errstr, $errfile, $errline) { // Remove ROOT path from the error string and file location $errstr = str_replace(ROOT, '', $errstr); $errfile = str_replace(ROOT, '', $errfile); switch ($errno) { case E_ERROR: case E_USER_ERROR: $error = "FATAL ERROR"; break; case E_WARNING: case E_USER_WARNING: $error = "WARNING"; break; case E_NOTICE: case E_USER_NOTICE: $error = "NOTICE"; break; default: $error = "Unknown error type [{$errno}]"; } $error .= ": {$errstr} on line {$errline} in {$errfile}"; // Truncate all previous outputs ob_clean(); ob_end_clean(); // Check for dev mode $detailed = config('dev.show_errors'); // Build page (not even going to bother cleaning this one up) $errorPage = ' Sakura Internal Error

An error occurred while executing the script.

To prevent potential security risks or data loss Sakura has stopped execution of the script.

'; if (isset($errid)) { $errorPage .= '

The error and surrounding data has been logged.

' . (!$detailed ? 'Report the following text to a staff member' : 'Logged as') . '

' . $errid . '
'; } else { $errorPage .= '

Sakura was not able to log this error which could mean that there was an error with the database connection. If you\'re the system administrator check the database credentials and make sure the server is running and if you\'re not please let the system administrator know about this error if it occurs again.

'; } if ($detailed) { $errorPage .= '

Summary

' . $error . '

Backtraces

'; foreach (debug_backtrace() as $num => $trace) { $errorPage .= '

#' . $num . '

';

            foreach ($trace as $key => $val) {
                $errorPage .=
                str_pad(
                    '[' . $key . ']',
                    12
                ) . '=> ' . (
                    is_array($val) || is_object($val) ?
                    json_encode($val) :
                    $val
                ) . "\r\n";
            }

            $errorPage .= '
'; } } $errorPage .= '
'; // Die and display error message die($errorPage); }