mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-24 22:11:01 -06:00
Merge branch 'master' of https://github.com/openclassify/openclassify
This commit is contained in:
commit
e66f9e3698
@ -17,7 +17,9 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% if setting_value('visiosoft.theme.base::price_fields') %}
|
{% if setting_value('visiosoft.theme.base::price_fields') %}
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<b>{{ adv.price }} {{ adv.currency }}</b>
|
<b>{{ adv.price != '0'
|
||||||
|
? adv.price.currency()
|
||||||
|
: trans('visiosoft.module.advs::field.free') }}</b>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="d-flex justify-content-between align-items-center text-truncate">
|
<div class="d-flex justify-content-between align-items-center text-truncate">
|
||||||
|
|||||||
@ -37,6 +37,9 @@ class Currency
|
|||||||
$suffix = $this->symbol($currency);
|
$suffix = $this->symbol($currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_object($number)) {
|
||||||
|
$number = $number->getValue();
|
||||||
|
}
|
||||||
|
|
||||||
$decimal_value = $this->getDecimalValue($number);
|
$decimal_value = $this->getDecimalValue($number);
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,88 @@
|
|||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Exception\ExceptionIdentifier;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Foundation\Exceptions\Handler;
|
use Illuminate\Foundation\Exceptions\Handler;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
|
||||||
class ExceptionHandler extends Handler
|
class ExceptionHandler extends Handler
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The exception instance.
|
||||||
|
*
|
||||||
|
* @var Exception
|
||||||
|
*/
|
||||||
|
protected $original;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of the exception types that should not be reported.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $internalDontReport = [
|
||||||
|
\Illuminate\Auth\AuthenticationException::class,
|
||||||
|
\Illuminate\Auth\Access\AuthorizationException::class,
|
||||||
|
\Symfony\Component\HttpKernel\Exception\HttpException::class,
|
||||||
|
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
|
||||||
|
\Illuminate\Session\TokenMismatchException::class,
|
||||||
|
\Illuminate\Validation\ValidationException::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function prepareException(Exception $e)
|
||||||
|
{
|
||||||
|
$this->original = $e;
|
||||||
|
|
||||||
|
return parent::prepareException($e); // TODO: Change the autogenerated stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render($request, Exception $e)
|
||||||
|
{
|
||||||
|
if ($e instanceof AuthenticationException) {
|
||||||
|
return $this->unauthenticated($request, $e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($e instanceof NotFoundHttpException && $redirect = config('streams::404.redirect')) {
|
||||||
|
return redirect($redirect);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::render($request, $e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function renderHttpException(HttpExceptionInterface $e)
|
||||||
|
{
|
||||||
|
if (env('APP_DEBUG') === true) {
|
||||||
|
return $this->convertExceptionToResponse($e);
|
||||||
|
}
|
||||||
|
|
||||||
|
$summary = $e->getMessage();
|
||||||
|
$headers = $e->getHeaders();
|
||||||
|
$code = $e->getStatusCode();
|
||||||
|
$name = trans("streams::error.{$code}.name");
|
||||||
|
$message = trans("streams::error.{$code}.message");
|
||||||
|
$id = $this->container->make(ExceptionIdentifier::class)->identify($this->original);
|
||||||
|
|
||||||
|
if (view()->exists($view = "streams::errors/{$code}")) {
|
||||||
|
return response()->view($view, compact('id', 'code', 'name', 'message', 'summary'), $code, $headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->view(
|
||||||
|
'streams::errors/error',
|
||||||
|
compact('id', 'code', 'name', 'message', 'summary'),
|
||||||
|
$code,
|
||||||
|
$headers
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function report(Exception $e)
|
public function report(Exception $e)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -18,4 +93,33 @@ class ExceptionHandler extends Handler
|
|||||||
|
|
||||||
parent::report($e);
|
parent::report($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function context()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return array_filter(
|
||||||
|
[
|
||||||
|
'user' => Auth::id(),
|
||||||
|
'email' => Auth::user() ? Auth::user()->email : null,
|
||||||
|
'url' => request() ? request()->fullUrl() : null,
|
||||||
|
'identifier' => $this->container->make(ExceptionIdentifier::class)->identify($this->original),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function unauthenticated($request, AuthenticationException $exception)
|
||||||
|
{
|
||||||
|
if ($request->expectsJson()) {
|
||||||
|
return response()->json(['error' => 'Unauthenticated.'], 401);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->segment(1) === 'admin') {
|
||||||
|
return redirect()->guest('admin/login');
|
||||||
|
} else {
|
||||||
|
return redirect()->guest('login');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user